Skip to content
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

ScrollArea can collapse to nothingness #1097

Closed
emilk opened this issue Jan 11, 2022 · 0 comments · Fixed by #1255
Closed

ScrollArea can collapse to nothingness #1097

emilk opened this issue Jan 11, 2022 · 0 comments · Fixed by #1255
Labels
bug Something is broken

Comments

@emilk
Copy link
Owner

emilk commented Jan 11, 2022

If a ScrollArea is put into a Ui with a very small max_rect (i.e. no, or very little, space left), the ScrollArea will collapse to something tiny, which cannot be interacted with.

My proposed solution is if each ScrollArea has a min_scrolled_size of e.g. 100.0 points. By this I mean that when the scroll bars are showing, the outer ScrollArea size will not shrink below this. If the contents is smaller than this size though, the scroll bars doesn't need to show and so the outer size of the ScrollArea can become smaller.


This happens most frequently when nesting ScrollAreas.

The outer ScrollArea will, by default, tell its children "keep it small". This is so that text inside a horizontal scroll area still wraps, and so that "space-filling" widgets (e.g. an Image that fills all available space) inside the ScrollArea don't become huge just because they can.

You can stop this behavior by adding ui.set_max_height(1e6); between the two ScrollArea:s, though that will instead make the second ScrollArea take up all the height it want, with no need for it to show any scroll bars (so you will need to call .set_max_height(500.0) on it).

@emilk emilk added the bug Something is broken label Jan 11, 2022
emilk added a commit that referenced this issue Feb 16, 2022
emilk added a commit that referenced this issue Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant