Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48d9e11

Browse files
committed
fixed modebar resetdefault and setCamera call in plot_api
1 parent 428bd1c commit 48d9e11

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/modebar/buttons.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ function handleCamera3d(gd, ev) {
348348
var scene = fullLayout[sceneId]._scene;
349349

350350
if(attr === 'resetDefault') {
351-
aobj[key] = null;
351+
aobj[key] = Lib.extendDeep({}, scene.cameraInitial);
352+
aobj[key].up = null;
353+
aobj[key].eye = null;
354+
aobj[key].center = null;
352355
}
353356
else if(attr === 'resetLastSave') {
354357
aobj[key] = Lib.extendDeep({}, scene.cameraInitial);

src/plot_api/subroutines.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,10 @@ exports.doCamera = function(gd) {
600600
var sceneLayout = fullLayout[sceneIds[i]];
601601
var scene = sceneLayout._scene;
602602

603-
scene.setCamera(sceneLayout.camera);
603+
var cameraData = sceneLayout.camera;
604+
var isOrtho = !!(cameraData && cameraData.projection && cameraData.projection.type === 'orthographic');
605+
606+
scene.setCamera(cameraData, isOrtho);
604607
}
605608
};
606609

0 commit comments

Comments
 (0)