Skip to content

Commit 6bd58c9

Browse files
committed
improved gl-plot3d scene and camera modules to fixed issue 3576 - lock jasmine test
1 parent e48c820 commit 6bd58c9

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"gl-mat4": "^1.2.0",
8181
"gl-mesh3d": "^2.0.8",
8282
"gl-plot2d": "^1.4.2",
83-
"gl-plot3d": "git://github.com/gl-vis/gl-plot3d.git#7f63b591d13a3065a05a23a5d5a55d2b0480f225",
83+
"gl-plot3d": "git://github.com/gl-vis/gl-plot3d.git#5f28e06ac02b248e6990ef385d2df49bb3a7baf8",
8484
"gl-pointcloud2d": "^1.0.2",
8585
"gl-scatter3d": "^1.2.0",
8686
"gl-select-box": "^1.0.3",

src/plots/gl3d/scene.js

-12
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,6 @@ function Scene(options, fullLayout) {
352352
this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw');
353353

354354
initializeGLPlot(this, this.pixelRatio);
355-
356-
this.enableGLCameraMouseListener();
357355
}
358356

359357
var proto = Scene.prototype;
@@ -372,16 +370,6 @@ proto.initializeGLCamera = function() {
372370
zoomMax: 100,
373371
mode: 'orbit'
374372
});
375-
376-
this.disableGLCameraMouseListener();
377-
};
378-
379-
proto.enableGLCameraMouseListener = function() {
380-
this.camera.mouseListener.enabled = true;
381-
};
382-
383-
proto.disableGLCameraMouseListener = function() {
384-
this.camera.mouseListener.enabled = false;
385373
};
386374

387375
proto.recoverContext = function() {

test/jasmine/tests/gl3d_plot_interact_test.js

+23-3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ describe('Test gl3d before/after plot', function() {
7676
return delay(20)();
7777
}
7878

79+
function _clickOtherplace() {
80+
mouseEvent('mouseover', 300, 300, {buttons: 1});
81+
return delay(20)();
82+
}
83+
7984
_stayThere()
8085
.then(function() {
8186
gd = createGraphDiv();
@@ -118,11 +123,26 @@ describe('Test gl3d before/after plot', function() {
118123
expect(cameraAfter.center[0]).toBeCloseTo(0, 2, 'cameraAfter.center[0]');
119124
expect(cameraAfter.center[1]).toBeCloseTo(0, 2, 'cameraAfter.center[1]');
120125
expect(cameraAfter.center[2]).toBeCloseTo(0, 2, 'cameraAfter.center[2]');
121-
expect(cameraAfter.eye[0]).not.toBeCloseTo(1.2, 2, 'cameraAfter.eye[0]');
122-
expect(cameraAfter.eye[1]).not.toBeCloseTo(1.2, 2, 'cameraAfter.eye[1]');
123-
expect(cameraAfter.eye[2]).not.toBeCloseTo(1.2, 2, 'cameraAfter.eye[2]');
126+
expect(cameraAfter.eye[0]).toBeCloseTo(1.2, 2, 'cameraAfter.eye[0]');
127+
expect(cameraAfter.eye[1]).toBeCloseTo(1.2, 2, 'cameraAfter.eye[1]');
128+
expect(cameraAfter.eye[2]).toBeCloseTo(1.2, 2, 'cameraAfter.eye[2]');
124129
expect(cameraAfter.mouseListener.enabled === true);
125130
})
131+
.then(_clickOtherplace)
132+
.then(delay(20))
133+
.then(function() {
134+
var cameraFinal = gd._fullLayout.scene._scene.glplot.camera;
135+
expect(cameraFinal.up[0]).toBeCloseTo(0, 2, 'cameraFinal.up[0]');
136+
expect(cameraFinal.up[1]).toBeCloseTo(0, 2, 'cameraFinal.up[1]');
137+
expect(cameraFinal.up[2]).toBeCloseTo(1, 2, 'cameraFinal.up[2]');
138+
expect(cameraFinal.center[0]).toBeCloseTo(0, 2, 'cameraFinal.center[0]');
139+
expect(cameraFinal.center[1]).toBeCloseTo(0, 2, 'cameraFinal.center[1]');
140+
expect(cameraFinal.center[2]).toBeCloseTo(0, 2, 'cameraFinal.center[2]');
141+
expect(cameraFinal.eye[0]).not.toBeCloseTo(1.2, 2, 'cameraFinal.eye[0]');
142+
expect(cameraFinal.eye[1]).not.toBeCloseTo(1.2, 2, 'cameraFinal.eye[1]');
143+
expect(cameraFinal.eye[2]).not.toBeCloseTo(1.2, 2, 'cameraFinal.eye[2]');
144+
expect(cameraFinal.mouseListener.enabled === true);
145+
})
126146
.then(done);
127147
});
128148

0 commit comments

Comments
 (0)