File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed
Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -456,16 +456,26 @@ class Plot extends React.Component {
456456 return ;
457457 }
458458
459+ var canvas = imageRef . current . canvas . _canvas ;
459460
460- var dataURL = imageRef . current . toDataURL ( { pixelRatio : 3 } ) ;
461+ if ( canvas . msToBlob && navigator . msSaveBlob ) {
462+ // for IE
463+ var blob = canvas . msToBlob ( ) ;
464+ window . navigator . msSaveBlob ( blob , plotName ) ;
465+
466+ } else {
467+ // other browsers
468+
469+ var dataURL = imageRef . current . toDataURL ( { pixelRatio : 3 } ) ;
470+ var link = document . createElement ( 'a' ) ;
471+ link . download = plotName ;
472+ link . href = dataURL ;
473+ document . body . appendChild ( link ) ;
474+ link . click ( ) ;
475+ document . body . removeChild ( link ) ;
476+ link . remove ( ) ;
477+ }
461478
462- var link = document . createElement ( 'a' ) ;
463- link . download = plotName ;
464- link . href = dataURL ;
465- document . body . appendChild ( link ) ;
466- link . click ( ) ;
467- document . body . removeChild ( link ) ;
468- link . remove ( ) ;
469479 }
470480
471481 _filterDomains ( plotData , pdbs ) {
@@ -483,4 +493,4 @@ class Plot extends React.Component {
483493 }
484494}
485495
486- export default Plot ;
496+ export default Plot ;
You can’t perform that action at this time.
0 commit comments