Skip to content

Commit 536c90e

Browse files
committed
If image source is already in data uri form, process synchronously
This causes the image source to be updated at the same time as the image location.
1 parent dbe942a commit 536c90e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/components/images/draw.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ module.exports = function draw(gd) {
8484
var img = new Image();
8585
this.img = img;
8686

87+
if (d.source && d.source.slice(0, 5) === 'data:') {
88+
img.src = d.source;
89+
thisImage.attr('xlink:href', d.source);
90+
resolve();
91+
} else {
8792
// If not set, a `tainted canvas` error is thrown
8893
img.setAttribute('crossOrigin', 'anonymous');
8994
img.onerror = errorHandler;
@@ -109,6 +114,7 @@ module.exports = function draw(gd) {
109114
thisImage.on('error', errorHandler);
110115

111116
img.src = d.source;
117+
}
112118

113119
function errorHandler() {
114120
thisImage.remove();

0 commit comments

Comments
 (0)