Repository navigation
InteractiveViewer pan axis locking - #61019
Merged
Merged
Conversation
Closed
LongCatIsLooong
approved these changes
Jul 7, 2020
| && boundaryMargin.left.isFinite)), | ||
| super(key: key); | ||
|
|
||
| /// If true, panning is only allowed in the direction of the main axes. |
Contributor
There was a problem hiding this comment.
nit: I couldn't find the definition of "main axes". Maybe "horizontal axis or vertical axis"?
Contributor
Author
There was a problem hiding this comment.
Will do, that sounds better.
| /// If true, panning is only allowed in the direction of the main axes. | ||
| /// | ||
| /// In other words, when this is true, diagonal panning is not allowed. This | ||
| /// is a common pattern in tables where data is displayed in columns and rows. |
Contributor
There was a problem hiding this comment.
It appears to me that if the user initiates a horizontal drag, then they won't be able to change the direction to vertical later (in the same gesture). Maybe add documentation for this behavior too?
Contributor
Author
There was a problem hiding this comment.
That's right. I'll document it. It seems to be how Google Sheets works on my iPhone too.
| } | ||
|
|
||
| final Offset alignedTranslation = widget.alignPanAxis && _panAxis != null | ||
| && _gestureType == _GestureType.pan |
Contributor
There was a problem hiding this comment.
Can this be done in _onScaleUpdate to avoid checking _gestureType?
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This PR adds an
alignPanAxisparameter to InteractiveViewer. When true, panning is only allowed along the x or y axes, not diagonally.Related Issues
Closes #58043
Mentioned in #12878
Tests
I added the following tests:
Breaking Change
None.