Add scroll_to operation#1796
Merged
Merged
Conversation
hecrj
requested changes
Apr 17, 2023
Comment on lines
+69
to
+74
| pub struct CurrentOffset { | ||
| /// The [`AbsoluteOffset`] of a [`Scrollable`] | ||
| pub absolute: AbsoluteOffset, | ||
| /// The [`RelativeOffset`] of a [`Scrollable`] | ||
| pub relative: RelativeOffset, | ||
| } |
Member
There was a problem hiding this comment.
There's some redundancy here.
I think it'd be better to have a Window or Viewport type with the already existing private Offset, the content bounds, and the scrollable bounds.
Then we can expose relative_offset and absolute_offset methods in this type that compute the actual values from a single source of truth.
hecrj
approved these changes
Apr 20, 2023
hecrj
left a comment
Member
There was a problem hiding this comment.
Awesome!
I have made a change to compare the absolute offsets as well in notify_on_scroll, since it's theoretically possible that the relative offset stays the same but the absolute offset doesn't (e.g. if the bounds of the Scrollable change while scrolling). See 8a71140.
I think we can merge! 🚢
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Supersedes #1795
Exposes a new
scroll_tooperation to allow scrolling a scrollable to a desired "absolute" offset.