File tree 5 files changed +14
-8
lines changed
5 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -53,17 +53,17 @@ modeBarButtons.toImage = {
53
53
54
54
Lib . notifier ( 'Taking snapshot - this may take a few seconds' , 'long' ) ;
55
55
56
- if ( Lib . isIE ( ) ) {
56
+ if ( Lib . isIE ( ) ) {
57
57
Lib . notifier ( 'IE only supports svg. Changing format to svg.' , 'long' ) ;
58
58
format = 'svg' ;
59
59
}
60
60
61
- downloadImage ( gd , { 'format' :format } )
61
+ downloadImage ( gd , { 'format' : format } )
62
62
. then ( function ( filename ) {
63
63
Lib . notifier ( 'Snapshot succeeded - ' + filename , 'long' ) ;
64
64
} )
65
65
. 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' ) ;
67
67
} ) ;
68
68
}
69
69
} ;
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ function toImage(gd, opts) {
37
37
if ( isNumeric ( size ) && size > 1 ) {
38
38
return true ;
39
39
}
40
+
41
+ return false ;
40
42
} ;
41
43
42
44
if ( ! isSizeGood ( opts . width ) || ! isSizeGood ( opts . height ) ) {
@@ -80,7 +82,7 @@ function toImage(gd, opts) {
80
82
// compatibility
81
83
promise : true
82
84
} ) . then ( function ( url ) {
83
- if ( clonedGd ) clonedGd . remove ( ) ;
85
+ if ( clonedGd ) document . body . removeChild ( clonedGd ) ;
84
86
resolve ( url ) ;
85
87
} ) . catch ( function ( err ) {
86
88
reject ( err ) ;
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ var fileSaver = function(url, name) {
52
52
}
53
53
54
54
// 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 ) ;
57
57
resolve ( name ) ;
58
58
}
59
59
Original file line number Diff line number Diff line change @@ -56,7 +56,11 @@ function svgToImg(opts) {
56
56
img . onload = function ( ) {
57
57
var imgData ;
58
58
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
+ }
60
64
61
65
switch ( format ) {
62
66
case 'jpeg' :
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ function toImage(gd, opts) {
57
57
} ) ;
58
58
59
59
ev . clean = function ( ) {
60
- if ( clonedGd ) clonedGd . remove ( ) ;
60
+ if ( clonedGd ) document . body . removeChild ( clonedGd ) ;
61
61
} ;
62
62
63
63
} , delay ) ;
You can’t perform that action at this time.
0 commit comments