-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c50559a
include aspectmode changes in relayout updates
archmoj 20d4b3c
improve tests for aspectmode in relayouts
archmoj 1fdc49c
keep track of gl3d scene.aspectmode for modebar buttons
archmoj 6ae2809
improve aspectmode tests
archmoj c730f12
record initial aspectmode safely
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call. |
||
} | ||
|
||
// Update frame position for multi plots | ||
var domain = fullSceneLayout.domain || null; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
aspectmode
is turned to'manual'
and the only way to get back to originalaspectmode
is 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
viewInitial
props?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.
apsectmode
added toviewInitial
in 1fdc49c and tests are added in 6ae2809.