Skip to content

Preserve gl3d scene aspectratio after orthographic scroll zoom - #4578

Merged
archmoj merged 8 commits into
masterfrom
fix4514-preserve-gl3d-scene-aspectratio
Feb 12, 2020
Merged

Preserve gl3d scene aspectratio after orthographic scroll zoom#4578
archmoj merged 8 commits into
masterfrom
fix4514-preserve-gl3d-scene-aspectratio

Conversation

@archmoj

@archmoj archmoj commented Feb 12, 2020

Copy link
Copy Markdown
Contributor

Fixes #4514 restyle part
After refactoring parts of the gl3d/scene code related to computing aspectratio,
this PR fixes the bug in commit e29aceb.
Demo | Please change scales using scroll, then select a point. It shouldn't display initial scales.

@plotly/plotly_js

@archmoj archmoj added bug something broken status: reviewable labels Feb 12, 2020
Comment thread src/plots/gl3d/scene.js Outdated
aspectRatio = [1, 1, 1];
}
} else if(fullSceneLayout.aspectmode === 'cube') {
var aspectmode = scene._aspectmode || fullSceneLayout.aspectmode;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the difference between scene._aspectmode and fullSceneLayout.aspectmode ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

scene._aspectmode is an internal variable which is set after aspectratio values are computed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are there situations where scene._aspectmode and fullSceneLayout.aspectmode aren't the same?

@archmoj archmoj Feb 12, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is. Namely after using scroll zoom.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, but shouldn't the changes to aspectmode during scroll zoom propagate to fullLayout ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I initially tried to achieve that on another branch using relayout updates.
Since tests started failing, I thought that may not be ideal to override fullLayout in this case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm curious. Which tests fail?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are there situations where scene._aspectmode and fullSceneLayout.aspectmode aren't the same?

OK. This time I was able to make that work without a temporary variable: 1828797

@etpinard

Copy link
Copy Markdown
Contributor

Brilliant. 💃 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orthographic projection + zoom breaks hover and Plotly.restyle

2 participants