Skip to content

Commit eb8737b

Browse files
committed
no need to pass gl3d projection type in calls
1 parent 5dfdbcf commit eb8737b

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

src/components/modebar/buttons.js

+9-16
Original file line numberDiff line numberDiff line change
@@ -347,22 +347,15 @@ function handleCamera3d(gd, ev) {
347347
var key = sceneId + '.camera';
348348
var scene = fullLayout[sceneId]._scene;
349349

350-
if(attr === 'resetDefault' || attr === 'resetLastSave') {
351-
aobj[key] = {
352-
'up': scene.viewInitial.up,
353-
'eye': scene.viewInitial.eye,
354-
'center': scene.viewInitial.center,
355-
'projection': {
356-
type: (scene.camera._ortho) ?
357-
'orthographic' : 'perspective'
358-
}
359-
};
360-
}
361-
362-
if(attr === 'resetDefault') {
363-
aobj[key].up = null;
364-
aobj[key].eye = null;
365-
aobj[key].center = null;
350+
if(attr === 'resetLastSave') {
351+
aobj[key + '.up'] = scene.viewInitial.up;
352+
aobj[key + '.eye'] = scene.viewInitial.eye;
353+
aobj[key + '.center'] = scene.viewInitial.center;
354+
355+
} else if(attr === 'resetDefault') {
356+
aobj[key + '.up'] = null;
357+
aobj[key + '.eye'] = null;
358+
aobj[key + '.center'] = null;
366359
}
367360
}
368361

src/plots/gl3d/scene.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function initializeGLPlot(scene, camera, pixelRatio, canvas, gl) {
255255
if(scene.fullSceneLayout.dragmode === false) return;
256256

257257
var update = {};
258-
update[scene.id + '.camera'] = getLayoutCamera(scene.camera, scene.camera._ortho);
258+
update[scene.id + '.camera'] = getLayoutCamera(scene.camera);
259259
scene.saveCamera(gd.layout);
260260
scene.graphDiv.emit('plotly_relayout', update);
261261
};
@@ -758,19 +758,19 @@ function getOrbitCamera(camera) {
758758

759759
// getLayoutCamera :: orbit_camera_coords -> plotly_coords
760760
// inverse of getOrbitCamera
761-
function getLayoutCamera(camera, isOrtho) {
761+
function getLayoutCamera(camera) {
762762
return {
763763
up: {x: camera.up[0], y: camera.up[1], z: camera.up[2]},
764764
center: {x: camera.center[0], y: camera.center[1], z: camera.center[2]},
765765
eye: {x: camera.eye[0], y: camera.eye[1], z: camera.eye[2]},
766-
projection: {type: (isOrtho === true) ? 'orthographic' : 'perspective'}
766+
projection: {type: (camera._ortho === true) ? 'orthographic' : 'perspective'}
767767
};
768768
}
769769

770770
// get camera position in plotly coords from 'orbit-camera' coords
771771
proto.getCamera = function getCamera() {
772772
this.glplot.camera.view.recalcMatrix(this.camera.view.lastT());
773-
return getLayoutCamera(this.glplot.camera, this.glplot.camera._ortho);
773+
return getLayoutCamera(this.glplot.camera);
774774
};
775775

776776
// set camera position with a set of plotly coords

0 commit comments

Comments
 (0)