File tree Expand file tree Collapse file tree 5 files changed +14
-8
lines changed Expand file tree Collapse file tree 5 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -53,17 +53,17 @@ modeBarButtons.toImage = {
5353
5454 Lib . notifier ( 'Taking snapshot - this may take a few seconds' , 'long' ) ;
5555
56- if ( Lib . isIE ( ) ) {
56+ if ( Lib . isIE ( ) ) {
5757 Lib . notifier ( 'IE only supports svg. Changing format to svg.' , 'long' ) ;
5858 format = 'svg' ;
5959 }
6060
61- downloadImage ( gd , { 'format' :format } )
61+ downloadImage ( gd , { 'format' : format } )
6262 . then ( function ( filename ) {
6363 Lib . notifier ( 'Snapshot succeeded - ' + filename , 'long' ) ;
6464 } )
6565 . catch ( function ( ) {
66- Lib . notifier ( 'Sorry there was a problem downloading your snapshot' , 'long' ) ;
66+ Lib . notifier ( 'Sorry there was a problem downloading your snapshot! ' , 'long' ) ;
6767 } ) ;
6868 }
6969} ;
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ function toImage(gd, opts) {
3737 if ( isNumeric ( size ) && size > 1 ) {
3838 return true ;
3939 }
40+
41+ return false ;
4042 } ;
4143
4244 if ( ! isSizeGood ( opts . width ) || ! isSizeGood ( opts . height ) ) {
@@ -80,7 +82,7 @@ function toImage(gd, opts) {
8082 // compatibility
8183 promise : true
8284 } ) . then ( function ( url ) {
83- if ( clonedGd ) clonedGd . remove ( ) ;
85+ if ( clonedGd ) document . body . removeChild ( clonedGd ) ;
8486 resolve ( url ) ;
8587 } ) . catch ( function ( err ) {
8688 reject ( err ) ;
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ var fileSaver = function(url, name) {
5252 }
5353
5454 // IE 10+ (native saveAs)
55- if ( typeof navigator !== 'undefined' && navigator . msSaveOrOpenBlob ) {
56- navigator . msSaveOrOpenBlob ( url , name ) ;
55+ if ( typeof navigator !== 'undefined' && navigator . msSaveBlob ) {
56+ navigator . msSaveBlob ( new Blob ( [ url ] ) , name ) ;
5757 resolve ( name ) ;
5858 }
5959
Original file line number Diff line number Diff line change @@ -56,7 +56,11 @@ function svgToImg(opts) {
5656 img . onload = function ( ) {
5757 var imgData ;
5858
59- ctx . drawImage ( img , 0 , 0 ) ;
59+ // don't need to draw to canvas if svg
60+ // save some time and also avoid failure on IE
61+ if ( format !== 'svg' ) {
62+ ctx . drawImage ( img , 0 , 0 ) ;
63+ }
6064
6165 switch ( format ) {
6266 case 'jpeg' :
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ function toImage(gd, opts) {
5757 } ) ;
5858
5959 ev . clean = function ( ) {
60- if ( clonedGd ) clonedGd . remove ( ) ;
60+ if ( clonedGd ) document . body . removeChild ( clonedGd ) ;
6161 } ;
6262
6363 } , delay ) ;
You can’t perform that action at this time.
0 commit comments