Skip to content

Commit 0b04e60

Browse files
committed
plotly#29 add plotly_relayout event emission when camera is reset to default or saved
1 parent bb8137c commit 0b04e60

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/plots/gl3d/scene.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,13 @@ proto.destroy = function() {
559559
// for reset camera button in mode bar
560560
proto.setCameraToDefault = function setCameraToDefault() {
561561
// as in Gl3d.layoutAttributes
562-
this.glplot.camera.lookAt(
562+
var lookAtInput = [
563563
[1.25, 1.25, 1.25],
564564
[0, 0, 0],
565565
[0, 0, 1]
566-
);
566+
];
567+
this.glplot.camera.lookAt.apply(this, lookAtInput);
568+
gd.emit('plotly_relayout', lookAtInput);
567569
};
568570

569571
// get camera position in plotly coords from 'orbit-camera' coords
@@ -586,11 +588,13 @@ proto.setCamera = function setCamera(cameraData) {
586588
var up = cameraData.up;
587589
var center = cameraData.center;
588590
var eye = cameraData.eye;
589-
this.glplot.camera.lookAt(
591+
var lookAtInput = [
590592
[eye.x, eye.y, eye.z],
591593
[center.x, center.y, center.z],
592594
[up.x, up.y, up.z]
593-
);
595+
];
596+
this.glplot.camera.lookAt.apply(this, lookAtInput);
597+
gd.emit('plotly_relayout', lookAtInput);
594598
};
595599

596600
// save camera to user layout (i.e. gd.layout)

0 commit comments

Comments
 (0)