10000 Include gl3d scene.aspectmode changes in relayout updates by archmoj · Pull Request #4579 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Include gl3d scene.aspectmode changes in relayout updates #4579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
keep track of gl3d scene.aspectmode for modebar buttons
  • Loading branch information
archmoj committed Feb 13, 2020
commit 1fdc49c7c22dc3b73f7a0f3572b675ea2457b5b7
2 changes: 2 additions & 0 deletions src/components/modebar/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ function handleCamera3d(gd, ev) {
var sceneId = sceneIds[i];
var camera = sceneId + '.camera';
var aspectratio = sceneId + '.aspectratio';
var aspectmode = sceneId + '.aspectmode';
var scene = fullLayout[sceneId]._scene;
var didUpdate;

Expand All @@ -365,6 +366,7 @@ function handleCamera3d(gd, ev) {
aobj[aspectratio + '.x'] = scene.viewInitial.aspectratio.x;
aobj[aspectratio + '.y'] = scene.viewInitial.aspectratio.y;
aobj[aspectratio + '.z'] = scene.viewInitial.aspectratio.z;
aobj[aspectmode] = scene.viewInitial.aspectmode;
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/plots/gl3d/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,9 @@ proto.plot = function(sceneData, fullLayout, layout) {
y: fullSceneLayout.aspectratio.y,
z: fullSceneLayout.aspectratio.z
};

// also keep track of aspectmode here
scene.viewInitial.aspectmode = fullSceneLayout.aspectmode;
Copy link
Contributor
@etpinard etpinard Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be

if(!scene.viewInitial.aspectmode) {
  scene.viewInitial.aspectmode = fullSceneLayout.aspectmode
}

that way we don't override viewInitia.aspectmodel on updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.
We could. Done in c730f12.

}

// Update frame position for multi plots
Expand Down
0