Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improved logic
  • Loading branch information
archmoj committed Nov 18, 2018
commit 67ea4295d91a16c92f629a499c55723eb8d1c188
5 changes: 5 additions & 0 deletions src/plots/gl3d/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ exports.plot = function plotGl3d(gd) {
if(!scene.cameraInitial) {
scene.cameraInitial = Lib.extendDeep({}, sceneLayout.camera);
}
/*
if(!sceneLayout._scene.cameraInitial) {
sceneLayout._scene.cameraInitial = Lib.extendDeep({}, gd._fullLayout[sceneId].camera);
}
*/

scene.plot(fullSceneData, fullLayout, gd.layout);
}
Expand Down
18 changes: 7 additions & 11 deletions src/plots/gl3d/layout/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,15 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) {
sceneLayoutIn.aspectmode = sceneLayoutOut.aspectmode;
}

var overwrite = false;
var overwriteIn = false;
if(sceneLayoutIn.camera &&
sceneLayoutIn.camera.up &&
sceneLayoutIn.camera.up.z !== 1) {
overwrite = true;
overwriteIn = (sceneLayoutIn.dragmode !== 'turntable') ? true : false;
}

if(sceneLayoutIn.dragmode === 'turntable') {
overwrite = false;
}

if(overwrite === true) {
if(overwriteIn === true) {
sceneLayoutIn.dragmode = 'orbit';
} else {
if(sceneLayoutIn.dragmode === 'turntable') {
sceneLayoutIn.camera.up = [0, 0, 1];
}
}

supplyGl3dAxisLayoutDefaults(sceneLayoutIn, sceneLayoutOut, {
Expand All @@ -125,6 +117,10 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) {
fullLayout: opts.fullLayout
});

if(sceneLayoutOut.dragmode === 'turntable') {
sceneLayoutOut.camera.up = [0, 0, 1];
}

Registry.getComponentMethod('annotations3d', 'handleDefaults')(
sceneLayoutIn, sceneLayoutOut, opts
);
Expand Down
4 changes: 3 additions & 1 deletion test/jasmine/tests/gl3d_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ describe('Test gl3d modebar handlers', function() {
buttonDefault.click();
});

it('@gl button resetCameraLastSave3d should reset camera to default', function(done) {
fit('@gl button resetCameraLastSave3d should reset camera to default', function(done) {
var buttonDefault = selectButton(modeBar, 'resetCameraDefault3d');
var buttonLastSave = selectButton(modeBar, 'resetCameraLastSave3d');

Expand Down Expand Up @@ -808,6 +808,8 @@ describe('Test gl3d modebar handlers', function() {
assertCameraEye(gd._fullLayout.scene, 0.1, 0.1, 1);
assertCameraEye(gd._fullLayout.scene2, 2.5, 2.5, 2.5);

console.log("gd._fullLayout.scene._scene.cameraInitial=", gd._fullLayout.scene._scene.cameraInitial);

delete gd._fullLayout.scene._scene.cameraInitial;
delete gd._fullLayout.scene2._scene.cameraInitial;

Expand Down