Skip to content

Commit 9e1aa7a

Browse files
committed
cameraInitial > viewInitial
1 parent 4d7c1b4 commit 9e1aa7a

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

src/components/modebar/buttons.js

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

350350
if(attr === 'resetDefault' || attr === 'resetLastSave') {
351-
aobj[key] = Lib.extendDeep({}, scene.cameraInitial);
351+
aobj[key] = Lib.extendDeep({}, scene.viewInitial);
352352

353353
aobj[key].projection = {
354354
type: (scene.camera._ortho) ? 'orthographic' : 'perspective'

src/plots/gl3d/index.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,25 @@ exports.plot = function plotGl3d(gd) {
6767
sceneLayout._scene = scene;
6868
}
6969

70-
// save 'initial' camera settings for modebar button
71-
if(!scene.cameraInitial) {
72-
scene.cameraInitial = Lib.extendDeep({}, sceneLayout.camera);
70+
// save 'initial' camera view settings for modebar button
71+
if(!scene.viewInitial) {
72+
scene.viewInitial = {
73+
up: {
74+
x: sceneLayout.camera.up.x,
75+
y: sceneLayout.camera.up.y,
76+
z: sceneLayout.camera.up.z
77+
},
78+
eye: {
79+
x: sceneLayout.camera.eye.x,
80+
y: sceneLayout.camera.eye.y,
81+
z: sceneLayout.camera.eye.z
82+
},
83+
center: {
84+
x: sceneLayout.camera.center.x,
85+
y: sceneLayout.camera.center.y,
86+
z: sceneLayout.camera.center.z
87+
}
88+
};
7389
}
7490

7591
scene.plot(fullSceneData, fullLayout, gd.layout);

test/jasmine/tests/gl3d_plot_interact_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,8 @@ describe('Test gl3d modebar handlers', function() {
10431043
it('@gl button resetCameraDefault3d should reset camera to default', function(done) {
10441044
var buttonDefault = selectButton(modeBar, 'resetCameraDefault3d');
10451045

1046-
expect(gd._fullLayout.scene._scene.cameraInitial.eye).toEqual({ x: 0.1, y: 0.1, z: 1 });
1047-
expect(gd._fullLayout.scene2._scene.cameraInitial.eye).toEqual({ x: 2.5, y: 2.5, z: 2.5 });
1046+
expect(gd._fullLayout.scene._scene.viewInitial.eye).toEqual({ x: 0.1, y: 0.1, z: 1 });
1047+
expect(gd._fullLayout.scene2._scene.viewInitial.eye).toEqual({ x: 2.5, y: 2.5, z: 2.5 });
10481048

10491049
gd.once('plotly_relayout', function() {
10501050
assertScenes(gd._fullLayout, 'camera.eye.x', 1.25);
@@ -1099,8 +1099,8 @@ describe('Test gl3d modebar handlers', function() {
10991099
assertCameraEye(gd._fullLayout.scene, 0.1, 0.1, 1);
11001100
assertCameraEye(gd._fullLayout.scene2, 2.5, 2.5, 2.5);
11011101

1102-
delete gd._fullLayout.scene._scene.cameraInitial;
1103-
delete gd._fullLayout.scene2._scene.cameraInitial;
1102+
delete gd._fullLayout.scene._scene.viewInitial;
1103+
delete gd._fullLayout.scene2._scene.viewInitial;
11041104

11051105
Plotly.relayout(gd, {
11061106
'scene.bgcolor': '#d3d3d3',

0 commit comments

Comments
 (0)