@@ -15,6 +15,7 @@ var createPlot = glPlot3d.createScene;
15
15
16
16
var getContext = require ( 'webgl-context' ) ;
17
17
var passiveSupported = require ( 'has-passive-events' ) ;
18
+ var isMobile = require ( 'is-mobile' ) ( { tablet : true } ) ;
18
19
19
20
var Registry = require ( '../../registry' ) ;
20
21
var Lib = require ( '../../lib' ) ;
@@ -91,9 +92,14 @@ var proto = Scene.prototype;
91
92
92
93
proto . tryCreatePlot = function ( ) {
93
94
var scene = this ;
94
- var glplotOptions = {
95
+ var opts = {
95
96
canvas : scene . canvas ,
96
97
gl : scene . gl ,
98
+ glOptions : {
99
+ preserveDrawingBuffer : isMobile ,
100
+ premultipliedAlpha : true ,
101
+ antialias : true
102
+ } ,
97
103
container : scene . container ,
98
104
axes : scene . axesOptions ,
99
105
spikes : scene . spikeOptions ,
@@ -120,19 +126,19 @@ proto.tryCreatePlot = function() {
120
126
throw new Error ( 'error creating static canvas/context for image server' ) ;
121
127
}
122
128
}
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 ;
126
132
}
127
133
128
134
var failed = 0 ;
129
135
130
136
try {
131
- scene . glplot = createPlot ( glplotOptions ) ;
137
+ scene . glplot = createPlot ( opts ) ;
132
138
} catch ( e ) {
133
139
failed ++ ;
134
140
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 ) ;
136
142
} catch ( e ) {
137
143
failed ++ ;
138
144
}
0 commit comments