diff --git a/src/plots/gl3d/layout/defaults.js b/src/plots/gl3d/layout/defaults.js index 8ff078dd4f5..f9bb9236d3f 100644 --- a/src/plots/gl3d/layout/defaults.js +++ b/src/plots/gl3d/layout/defaults.js @@ -128,10 +128,12 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { var y = sceneLayoutIn.camera.up.y; var z = sceneLayoutIn.camera.up.z; - if(!x || !y || !z) { - dragmode = 'turntable'; - } else if(z / Math.sqrt(x * x + y * y + z * z) > 0.999) { - dragmode = 'turntable'; + if(z !== 0) { + if(!x || !y || !z) { + dragmode = 'turntable'; + } else if(z / Math.sqrt(x * x + y * y + z * z) > 0.999) { + dragmode = 'turntable'; + } } } else { dragmode = 'turntable'; diff --git a/test/image/baselines/gl3d_snowden_altered.png b/test/image/baselines/gl3d_snowden_altered.png index f24aa4b898f..dee05f0da39 100644 Binary files a/test/image/baselines/gl3d_snowden_altered.png and b/test/image/baselines/gl3d_snowden_altered.png differ diff --git a/test/jasmine/tests/gl3d_plot_interact_test.js b/test/jasmine/tests/gl3d_plot_interact_test.js index 7578762f3a2..382616c048f 100644 --- a/test/jasmine/tests/gl3d_plot_interact_test.js +++ b/test/jasmine/tests/gl3d_plot_interact_test.js @@ -511,7 +511,8 @@ describe('Test gl3d plots', function() { camera: { up: { x: null, - z: 0 + y: 0.5, + z: 0.5 } } } @@ -524,7 +525,7 @@ describe('Test gl3d plots', function() { .then(done); }); - it('@gl should set the camera dragmode to turntable if all camera.up.[x|y|z] are zero or missing', function(done) { + it('@gl should not set the camera dragmode to turntable if camera.up.z is zero.', function(done) { Plotly.plot(gd, { data: [{ type: 'scatter3d', @@ -536,7 +537,7 @@ describe('Test gl3d plots', function() { scene: { camera: { up: { - x: 0, + x: 1, y: 0, z: 0 } @@ -546,7 +547,7 @@ describe('Test gl3d plots', function() { }) .then(delay(20)) .then(function() { - expect(gd._fullLayout.scene.dragmode === 'turntable').toBe(true); + expect(gd._fullLayout.scene.dragmode === 'turntable').not.toBe(true); }) .then(done); });