Skip to content

Commit d8af1dc

Browse files
committed
add glOptions so that it is contolled by plotly.js not gl-plot3d
1 parent 94ebb09 commit d8af1dc

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/plots/gl3d/scene.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var createPlot = glPlot3d.createScene;
1515

1616
var getContext = require('webgl-context');
1717
var passiveSupported = require('has-passive-events');
18+
var isMobile = require('is-mobile')({ tablet: true });
1819

1920
var Registry = require('../../registry');
2021
var Lib = require('../../lib');
@@ -91,9 +92,14 @@ var proto = Scene.prototype;
9192

9293
proto.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

Comments
 (0)