-
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
Experiment with a new Group
container
#4631
base: master
Are you sure you want to change the base?
Conversation
#[derive(Clone, Copy, Debug, PartialEq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] | ||
#[must_use = "You should call .show()"] | ||
pub struct Group { |
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.
Is Ui::group
going to be changed to use this? Or maybe renamed to avoid confusion?
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 don't know yet. This is all very much related to #4634 in that I would like a simple way to create a new Ui
which has opt-in support for the new "grouping" behavior of this PR, as well as a frame (like ui.group
does).
I made the following change on this branch to see if it fixes emilk/egui_plot#15: M crates/egui_plot/src/lib.rs
@@ -723,7 +723,9 @@ impl<'a> Plot<'a> {
ui: &mut Ui,
build_fn: impl FnOnce(&mut PlotUi) -> R + 'a,
) -> PlotResponse<R> {
- self.show_dyn(ui, Box::new(build_fn))
+ Group::new(self.id_source.with("group"))
+ .show(ui, |ui| self.show_dyn(ui, Box::new(build_fn)))
+ .inner
} And it does, so that's nice. |
Would this also fix #4039 ? |
yup, but with a frame of nothingness before the content show up
|
Using the new sizing pass logic, we can now support centering of a group of widgets, something we couldn't support before.
This needs more work before it would be ready to use though.