Skip to content

Commit 496059c

Browse files
committed
simplify gl3d pixelRatio pass
1 parent d486dcd commit 496059c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/plots/gl3d/scene.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ function tryCreatePlot(scene, cameraObject, pixelRatio, canvas, gl) {
248248
return failed < 2;
249249
}
250250

251-
function initializeGLPlot(scene, pixelRatio, canvas, gl) {
251+
function initializeGLPlot(scene, canvas, gl) {
252252
scene.initializeGLCamera();
253253

254-
var success = tryCreatePlot(scene, scene.camera, pixelRatio, canvas, gl);
254+
var success = tryCreatePlot(scene, scene.camera, scene.pixelRatio, canvas, gl);
255255
/*
256256
* createPlot will throw when webgl is not enabled in the client.
257257
* Lets return an instance of the module with all functions noop'd.
@@ -393,7 +393,7 @@ function Scene(options, fullLayout) {
393393
this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert');
394394
this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw');
395395

396-
initializeGLPlot(this, this.pixelRatio);
396+
initializeGLPlot(this);
397397
}
398398

399399
var proto = Scene.prototype;
@@ -417,15 +417,15 @@ proto.recoverContext = function() {
417417
var scene = this;
418418
var gl = this.glplot.gl;
419419
var canvas = this.glplot.canvas;
420-
var pixelRatio = this.glplot.pixelRatio;
420+
421421
this.glplot.dispose();
422422

423423
function tryRecover() {
424424
if(gl.isContextLost()) {
425425
requestAnimationFrame(tryRecover);
426426
return;
427427
}
428-
if(!initializeGLPlot(scene, pixelRatio, canvas, gl)) {
428+
if(!initializeGLPlot(scene, canvas, gl)) {
429429
Lib.error('Catastrophic and unrecoverable WebGL error. Context lost.');
430430
return;
431431
}
@@ -825,8 +825,6 @@ proto.setViewport = function(sceneLayout) {
825825
if(newOrtho !== oldOrtho) {
826826
this.glplot.redraw();
827827

828-
var pixelRatio = this.glplot.pixelRatio;
829-
830828
var RGBA = this.glplot.clearColor;
831829
this.glplot.gl.clearColor(
832830
RGBA[0], RGBA[1], RGBA[2], RGBA[3]
@@ -838,7 +836,7 @@ proto.setViewport = function(sceneLayout) {
838836

839837
this.glplot.dispose();
840838

841-
initializeGLPlot(this, pixelRatio);
839+
initializeGLPlot(this);
842840
this.glplot.camera._ortho = newOrtho;
843841
}
844842
};

0 commit comments

Comments
 (0)