@@ -15,6 +15,7 @@ var createPlot = glPlot3d.createScene;
1515
1616var getContext = require ( 'webgl-context' ) ;
1717var passiveSupported = require ( 'has-passive-events' ) ;
18+ var isMobile = require ( 'is-mobile' ) ( { tablet : true } ) ;
1819
1920var Registry = require ( '../../registry' ) ;
2021var Lib = require ( '../../lib' ) ;
@@ -91,9 +92,14 @@ var proto = Scene.prototype;
9192
9293proto . tryCreatePlot = function ( ) {
9394 var scene = this ;
94- var glplotOptions = {
95+ var opts = {
9596 canvas : scene . canvas ,
9697 gl : scene . gl ,
98+ glOptions : {
99+ preserveDrawingBuffer : isMobile ,
100+ premultipliedAlpha : true ,
101+ antialias : true
102+ } ,
97103 container : scene . container ,
98104 axes : scene . axesOptions ,
99105 spikes : scene . spikeOptions ,
@@ -120,19 +126,19 @@ proto.tryCreatePlot = function() {
120126 throw new Error ( 'error creating static canvas/context for image server' ) ;
121127 }
122128 }
123- glplotOptions . pixelRatio = scene . pixelRatio ;
124- glplotOptions . gl = STATIC_CONTEXT ;
125- glplotOptions . canvas = STATIC_CANVAS ;
129+
130+ opts . gl = STATIC_CONTEXT ;
131+ opts . canvas = STATIC_CANVAS ;
126132 }
127133
128134 var failed = 0 ;
129135
130136 try {
131- scene . glplot = createPlot ( glplotOptions ) ;
137+ scene . glplot = createPlot ( opts ) ;
132138 } catch ( e ) {
133139 failed ++ ;
134140 try { // try second time to fix issue with Chrome 77 https://github.com/plotly/plotly.js/issues/4233
135- scene . glplot = createPlot ( glplotOptions ) ;
141+ scene . glplot = createPlot ( opts ) ;
136142 } catch ( e ) {
137143 failed ++ ;
138144 }
0 commit comments