Unsnap scrollable after snap_to
operation
#1795
Closed
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.
When issuing a
snap_to
operation to a scrollable, it leaves it's offset "relative".This is typically fine, except for when you use
on_scroll
/snap_to
to keep 2 separate scrollables in "sync". For example, consider a table widget that has a separateheader
scrollable from it'sbody
scrollable. We can keep theheader
in sync w/ thebody
by firingsnap_to
on theheader
from thebody
'son_scroll
message. If you have "resizing" functionality setup on the columns of the table and you are horizontally scrolled and try to "resize" a column, the two scrollables now behave in opposite ways.The
header
which is atrelative
will stayx%
scrolled as the width of the table changes, causing the viewport of the scrollable to change relative to the content.The
body
which is atabsolute
will stay scrolled atx
regardless of the width changing, keeping the viewport static.The behavior of always having an
absolute
offset stored is desired for when content width changes.This fixes the issue by always "unsnapping" after offset changes from an operation.