You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/02/17 08:00:41 UTC
[echarts-examples] branch gh-pages updated: fix image cors
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/echarts-examples.git
The following commit(s) were added to refs/heads/gh-pages by this push:
new 89639a5 fix image cors
89639a5 is described below
commit 89639a575497591372d5392c3e564e120f23be72
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Feb 17 15:59:50 2021 +0800
fix image cors
---
public/data-gl/animating-contour-on-globe.js | 17 +++++++++--------
public/data-gl/globe-contour-paint.js | 13 +++++++------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/public/data-gl/animating-contour-on-globe.js b/public/data-gl/animating-contour-on-globe.js
index 407718f..c6cbfed 100644
--- a/public/data-gl/animating-contour-on-globe.js
+++ b/public/data-gl/animating-contour-on-globe.js
@@ -41,13 +41,13 @@ $.when(
for (var j = 0, k = 0; j < m; ++j) {
for (var i = 0; i < n; ++i, ++k) {
- values[k] = image.data[(k << 2)] / 255;
+ values[k] = image.data[(k << 2)] / 255;
}
}
var opt = {
image: canvas
- }
+ };
var results = [];
function update(threshold, levels) {
@@ -88,13 +88,14 @@ $.when(
return new Promise(function(resolve) {
var image = new Image();
image.src = url;
+ image.crossOrigin = 'Anonymous';
image.onload = function() {
- var canvas = document.createElement("canvas");
- canvas.width = image.width / 8;
- canvas.height = image.height / 8;
- var context = canvas.getContext("2d");
- context.drawImage(image, 0, 0, canvas.width, canvas.height);
- resolve(context.getImageData(0, 0, canvas.width, canvas.height));
+ var canvas = document.createElement('canvas');
+ canvas.width = image.width / 8;
+ canvas.height = image.height / 8;
+ var context = canvas.getContext('2d');
+ context.drawImage(image, 0, 0, canvas.width, canvas.height);
+ resolve(context.getImageData(0, 0, canvas.width, canvas.height));
};
});
}
diff --git a/public/data-gl/globe-contour-paint.js b/public/data-gl/globe-contour-paint.js
index 30a9815..22d2d63 100644
--- a/public/data-gl/globe-contour-paint.js
+++ b/public/data-gl/globe-contour-paint.js
@@ -85,13 +85,14 @@ function image(url) {
return new Promise(function(resolve) {
var image = new Image();
image.src = url;
+ image.crossOrigin = 'Anonymous';
image.onload = function() {
- var canvas = document.createElement("canvas");
- canvas.width = image.width / 4;
- canvas.height = image.height / 4;
- var context = canvas.getContext("2d");
- context.drawImage(image, 0, 0, canvas.width, canvas.height);
- resolve(context.getImageData(0, 0, canvas.width, canvas.height));
+ var canvas = document.createElement("canvas");
+ canvas.width = image.width / 4;
+ canvas.height = image.height / 4;
+ var context = canvas.getContext("2d");
+ context.drawImage(image, 0, 0, canvas.width, canvas.height);
+ resolve(context.getImageData(0, 0, canvas.width, canvas.height));
};
});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org