-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 auto_shrink()
function to egui::Window
#4602
Conversation
/// Show the [`ScrollArea::auto_shrink`] | ||
#[inline] | ||
pub fn auto_shrink(mut self, auto_shrink: impl Into<Vec2b>) -> Self { | ||
self.scroll = self.scroll.auto_shrink(auto_shrink); |
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.
From the docs of ScrollArea::auto_shrink
:
- If
true
, egui will add blank space outside the scroll area.- If
false
, egui will add blank space inside the scroll area.
For a window we never want blank space outside the scroll area, so we should just change the default of Window::scroll
to always have .auto_shrink(false)
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.
I didn't fully understand what you meant.
This doesn't seem to be clearly explained in ScrollArea::auto_shrink
.
If we want to change the default value of egui::Window
,
- we can either change the default value of
ScrollArea::auto_shrink
tofalse
,
OR
- add an
auto_shrink
variable toegui::Window
.
I am unsure of which option is the best approach.
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.
In Window::new
do scroll: ScrollArea::neither().auto_shrink(false)
/// | ||
/// Show the [`ScrollArea::auto_shrink`] | ||
#[inline] | ||
pub fn auto_shrink(mut self, auto_shrink: impl Into<Vec2b>) -> Self { |
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.
and now you can remove this
/// If there is [`ScrollArea`], For each axis, should the containing area shrink if the content is small? | ||
#[inline] | ||
pub fn auto_shrink(mut self, auto_shrink: impl Into<Vec2b>) -> Self { | ||
self.scroll = self.scroll.auto_shrink(auto_shrink); | ||
self | ||
} | ||
|
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.
/// If there is [`ScrollArea`], For each axis, should the containing area shrink if the content is small? | |
#[inline] | |
pub fn auto_shrink(mut self, auto_shrink: impl Into<Vec2b>) -> Self { | |
self.scroll = self.scroll.auto_shrink(auto_shrink); | |
self | |
} |
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.
The new code you suggested is the same as the original one. There seems to be no changes in the suggestion.
This ensures that the scroll bars are always the outermost * Closes #4602
Set `auto_shrink(false)` on `Window`s `ScrollArea`. This ensures that the scroll bars are always the outermost. * Closes emilk#4602
Add
auto_shrink()
function toegui::Window