Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c50559a20d4b3c1fdc49c6ae2809c730f12File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -155,7 +155,7 @@ proto.tryCreatePlot = function() { | ||
| 'webgl setup failed possibly due to', | ||
| isMobile ? 'disabling' : 'enabling', | ||
| 'preserveDrawingBuffer config.', | ||
| 'The device may not be supported by isMobile module!', | ||
| 'The device may not be supported by is-mobile module!', | ||
| 'Inverting preserveDrawingBuffer option in second attempt to create webgl scene.' | ||
| ].join(' ')); | ||
| isMobile = opts.glOptions.preserveDrawingBuffer = !opts.glOptions.preserveDrawingBuffer; | ||
| @@ -219,6 +219,12 @@ proto.initializeGLPlot = function() { | ||
| if(scene.isAspectChanged(layout)) { | ||
| // scene updates | ||
| update[scene.id + '.aspectratio'] = scene.glplot.getAspectratio(); | ||
| if(layout[scene.id].aspectmode !== 'manual') { | ||
| scene.fullSceneLayout.aspectmode = | ||
| layout[scene.id].aspectmode = | ||
| update[scene.id + '.aspectmode'] = 'manual'; | ||
| } | ||
| } | ||
| return update; | ||
| @@ -246,7 +252,6 @@ proto.initializeGLPlot = function() { | ||
| y: s * o.y, | ||
| z: s * o.z | ||
| }); | ||
| scene.fullSceneLayout.aspectmode = layout[scene.id].aspectmode = 'manual'; | ||
| } | ||
| relayoutCallback(scene); | ||
| @@ -778,14 +783,17 @@ proto.plot = function(sceneData, fullLayout, layout) { | ||
| */ | ||
| scene.glplot.setAspectratio(fullSceneLayout.aspectratio); | ||
| // save 'initial' camera view settings for modebar button | ||
| // save 'initial' aspectratio & aspectmode view settings for modebar buttons | ||
| if(!scene.viewInitial.aspectratio) { | ||
| scene.viewInitial.aspectratio = { | ||
| x: fullSceneLayout.aspectratio.x, | ||
| y: fullSceneLayout.aspectratio.y, | ||
| z: fullSceneLayout.aspectratio.z | ||
| }; | ||
| } | ||
| if(!scene.viewInitial.aspectmode) { | ||
| scene.viewInitial.aspectmode = fullSceneLayout.aspectmode; | ||
| ||
| } | ||
| // Update frame position for multi plots | ||
| var domain = fullSceneLayout.domain || null; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we get back to the original
aspectmode?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When resetting the view (e.g via the modebar buttons), yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I think we have some tests related to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plotly.js/test/jasmine/tests/plot_api_test.js
Lines 394 to 411 in 4d24c36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, to be clear, once a user scrolls into a orthographic scene, the
aspectmodeis turned to'manual'and the only way to get back to originalaspectmodeis by resetting the view?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we should keep that in
viewInitialprops?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is it handled currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apsectmodeadded toviewInitialin 1fdc49c and tests are added in 6ae2809.