-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix scrolling in UI example #8069
Conversation
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.
This looks a lot more like the kind of fix I would expect for this issue. This implementation of a ScrollView looks non-ideal as it seems that it will cause a relayout on every scroll position change. Ideally I'd want a scrollview that only affect drawing and not layout. However, that issue was already present and is not introduced by this fix.
I think this is probably as good as it gets in "user approachable example code," right now, right? Or do we have some way of offsetting a UI node without causing a relayout (other than modifying the |
Probably. I'm not really familiar with Bevy's rendering code. But this really ought to be built-in. In which case we could probably do something better. |
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.
Looks good, makes much more sense and is much less complicated than the old implementation.
Co-authored-by: Carter Anderson <[email protected]>
Co-authored-by: Carter Anderson <[email protected]>
Co-authored-by: Carter Anderson <[email protected]>
Co-authored-by: Carter Anderson <[email protected]>
Objective
Fixes #8056
Alternative to #8061
Solution
Prior to this PR, the inner container was being constrained to the height of the outer container. The scroll range was being determined by the inner container's height and a sum obtained by iterating over every list item in the container.
With this PR, I let the inner container stretch to the height of its contents. The scroll range is simple to get from the outer and inner container heights.
I'm not sure why it was implemented this way, but it's possible that this was working around a very old stretch/taffy bug or something.
There's some additional explanation of what is going on and why the old implementation worked in Bevy 0.9 but not Bevy 0.10 in #8061.
This also cleans up a few unnecessary styles.