Skip to content

Commit 58e47c4

Browse files
committed
fixed reset camera to work after switching projection types
1 parent ecfa45a commit 58e47c4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/components/modebar/buttons.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,19 @@ function handleCamera3d(gd, ev) {
347347
var key = sceneId + '.camera';
348348
var scene = fullLayout[sceneId]._scene;
349349

350-
if(attr === 'resetDefault') {
350+
if(attr === 'resetDefault' || attr === 'resetLastSave') {
351351
aobj[key] = Lib.extendDeep({}, scene.cameraInitial);
352+
353+
aobj[key].projection = {
354+
type: (scene.camera._ortho) ? 'orthographic' : 'perspective'
355+
};
356+
}
357+
358+
if(attr === 'resetDefault') {
352359
aobj[key].up = null;
353360
aobj[key].eye = null;
354361
aobj[key].center = null;
355362
}
356-
else if(attr === 'resetLastSave') {
357-
aobj[key] = Lib.extendDeep({}, scene.cameraInitial);
358-
}
359363
}
360364

361365
Registry.call('_guiRelayout', gd, aobj);

src/plot_api/plot_api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,7 @@ function _restyle(gd, aobj, traces) {
15891589
// and figure out what kind of graphics update we need to do
15901590
for(var ai in aobj) {
15911591
if(helpers.hasParent(aobj, ai)) {
1592-
throw new Error('cannot set ' + ai + 'and a parent attribute simultaneously');
1592+
throw new Error('cannot set ' + ai + ' and a parent attribute simultaneously');
15931593
}
15941594

15951595
var vi = aobj[ai];
@@ -2095,7 +2095,7 @@ function _relayout(gd, aobj) {
20952095
// alter gd.layout
20962096
for(var ai in aobj) {
20972097
if(helpers.hasParent(aobj, ai)) {
2098-
throw new Error('cannot set ' + ai + 'and a parent attribute simultaneously');
2098+
throw new Error('cannot set ' + ai + ' and a parent attribute simultaneously');
20992099
}
21002100

21012101
var p = layoutNP(layout, ai);

0 commit comments

Comments
 (0)