8000 make camera modebar button update camera via fullLayou.scene?, · tulip/plotly.js@9010006 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.

Commit 9010006

Browse files
committed
make camera modebar button update camera via fullLayou.scene?,
- which is more robust then via layout (in case where users partly supply the camera object.
1 parent 1180a8f commit 9010006

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/components/modebar/buttons.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -336,29 +336,19 @@ modeBarButtons.resetCameraLastSave3d = {
336336
function handleCamera3d(gd, ev) {
337337
var button = ev.currentTarget,
338338
attr = button.getAttribute('data-attr'),
339-
layout = gd.layout,
340339
fullLayout = gd._fullLayout,
341340
sceneIds = Plotly.Plots.getSubplotIds(fullLayout, 'gl3d');
342341

343342
for(var i = 0; i < sceneIds.length; i++) {
344343
var sceneId = sceneIds[i],
345-
sceneLayout = layout[sceneId],
346344
fullSceneLayout = fullLayout[sceneId],
347345
scene = fullSceneLayout._scene;
348346

349-
if(!sceneLayout || attr==='resetDefault') scene.setCameraToDefault();
347+
if(attr === 'resetDefault') scene.setCameraToDefault();
350348
else if(attr === 'resetLastSave') {
351-
352-
var cameraPos = sceneLayout.camera;
353-
if(cameraPos) scene.setCamera(cameraPos);
354-
else scene.setCameraToDefault();
349+
scene.setCamera(fullSceneLayout.camera);
355350
}
356351
}
357-
358-
/*
359-
* TODO have a sceneLastTouched in _fullLayout to only
360-
* update the camera of the scene last touched by the user
361-
*/
362352
}
363353

364354
modeBarButtons.hoverClosest3d = {

0 commit comments

Comments
 (0)
0