@@ -89,31 +89,31 @@ module.exports = function draw(gd) {
8989 thisImage . attr ( 'xlink:href' , d . source ) ;
9090 resolve ( ) ;
9191 } else {
92- // If not set, a `tainted canvas` error is thrown
93- img . setAttribute ( 'crossOrigin' , 'anonymous' ) ;
94- img . onerror = errorHandler ;
95- img . onload = function ( ) {
96- var canvas = document . createElement ( 'canvas' ) ;
97- canvas . width = this . width ;
98- canvas . height = this . height ;
92+ // If not set, a `tainted canvas` error is thrown
93+ img . setAttribute ( 'crossOrigin' , 'anonymous' ) ;
94+ img . onerror = errorHandler ;
95+ img . onload = function ( ) {
96+ var canvas = document . createElement ( 'canvas' ) ;
97+ canvas . width = this . width ;
98+ canvas . height = this . height ;
9999
100- var ctx = canvas . getContext ( '2d' ) ;
101- ctx . drawImage ( this , 0 , 0 ) ;
100+ var ctx = canvas . getContext ( '2d' ) ;
101+ ctx . drawImage ( this , 0 , 0 ) ;
102102
103- var dataURL = canvas . toDataURL ( 'image/png' ) ;
103+ var dataURL = canvas . toDataURL ( 'image/png' ) ;
104104
105- thisImage . attr ( 'xlink:href' , dataURL ) ;
105+ thisImage . attr ( 'xlink:href' , dataURL ) ;
106106
107- // resolve promise in onload handler instead of on 'load' to support IE11
108- // see https://github.com/plotly/plotly.js/issues/1685
109- // for more details
110- resolve ( ) ;
111- } ;
107+ // resolve promise in onload handler instead of on 'load' to support IE11
108+ // see https://github.com/plotly/plotly.js/issues/1685
109+ // for more details
110+ resolve ( ) ;
111+ } ;
112112
113113
114- thisImage . on ( 'error' , errorHandler ) ;
114+ thisImage . on ( 'error' , errorHandler ) ;
115115
116- img . src = d . source ;
116+ img . src = d . source ;
117117 }
118118
119119 function errorHandler ( ) {
0 commit comments