Conversation
|
The original patch positioned the scroll bar incorrectly when the content was smaller than the |
|
I just discovered another bug in the Wall of text, lots of screen shots...First, this is what it looks like with a window-with-scroll-bar that is about the same width as its parent: There is something else interesting to note: The width of the clipping rect on the side bar takes up all available width (except for space for a scroll bar)! This will be important later... If I start resizing the settings window horizontally to the right, it will eventually become wider than the parent. The scroll bar will go out of view, but the clipping rect is pinned to the parent width: This improperly clips the contents and leaves a gap that is the same size as the scroll bar that is now going under the fold. If I keep stretching the window width, you can see the clipping issue quite clearly: Now with the patch in c080ca9, we can see how different it is when the window gets just too wide for the parent: The right side of the collapsible headers no longer gets clipped. You can make out the rounded corners. Also! Notice that now the clipping rect for the sidebar is the expected size. And if we keep stretching the window width, everything is fine: I did a little digging and it looks like the original clipping logic was introduced in 24ce7b4, and then fixed for the |
emilk
left a comment
There was a problem hiding this comment.
Thanks for the digging into this!
Seems the code not only became more correct, but also shorter! Awesome :)
This is an alternative attempt to fix the bug mentioned in #392 egui expects that the container can always be made wider, which is true for all egui Ui:s, but not true for the outer frame/chrome that egui ultimately needs to sit within.
This is an alternative attempt to fix the bug mentioned in #392 egui expects that the container can always be made wider, which is true for all egui Ui:s, but not true for the outer frame/chrome that egui ultimately needs to sit within.
* Make sure the scroll bar is never outside the screen rectangle This is an alternative attempt to fix the bug mentioned in #392 egui expects that the container can always be made wider, which is true for all egui Ui:s, but not true for the outer frame/chrome that egui ultimately needs to sit within. * Clamp scroll to screen rect rather than available rect * Fix scrollbar spacing when shrinking too small * Update changelog






While experimenting with #391, I noticed a bug in the way the vertical scroll bar is positioned. The screens below show the demo app resized to various widths.
A wide window looks nice, the scroll bar is firmly attached to the right side of the window:
At some point, when the window is made thinner, the scroll bar begins to disappear behind the window border:
When the window is very thin, you can see contents getting clipped as if the scroll bar should appear in the blank space:
With this very simple patch, the scroll bar correctly sits in that blank space:
And bonus, wide windows still allow the scroll bar to stick to the right edge (see first screen).