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
Add some way to specify whether scroll_to_rect etc.. should be animated #4295
Comments
lucasmerlin
changed the title
Add some way to specify whether scroll_to etc.. should be animated
Add some way to specify whether scroll_to_rect etc.. should be animated
Mar 31, 2024
Please also refer to the following: settings_ui -> Style -> Always scroll the only enabled direction ui.style_mut().always_scroll_the_only_direction = false; |
This was referenced Apr 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Egui should allow specifying whether scrolling in a ScrollArea should be animated (and also allow changing the animation duration, although that is not important for my problem)
Is your feature request related to a problem? Please describe.
After #4119 scrolling to a certain offset is always animated, this breaks egui_virtual_list, which relied on scroll_to_rect to instantly update the scroll position. This is necessary when the user scrolls up in a infinite scroll list that loads at the top and new content is added at the top (the scroll position is offset by the height of the new content). If the scroll is animated here, the list unexpectedly jumps for the user.
Describe the solution you'd like
Maybe add an additional parameter to the scroll functions, a bool or maybe a enum like
I also saw a TODO comment saying this should be made configurable via Style, but that would cause an issue for my crate, if I set the scroll animation duration to zero the user might override this at a later point causing the infinite scroll to break. The user could work around this by only updating the style if scroll_to_* is actually called but this wouldn't be ideal.
Maybe there could be e.g. a scroll_to_rect() with the current signature which uses the value from Style and an additional funciton like scroll_to_rect_animated() that takes the enum from above as an additional argument.
Describe alternatives you've considered
My problem could also be solved by #2783, which would allow me to use scroll_with_delta, which curiously doesn't seem to have an animation (I'm not sure if this is intentional). But due to #2783, scroll_with_delta doesn't work reliably for me.
The text was updated successfully, but these errors were encountered: