diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index 0caf7bec5..066ddc17d 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -2408,11 +2408,16 @@ impl Ui { /// }); /// # }); /// ``` + /// + /// See also [`Self::scope_builder`] for more options. pub fn scope(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse { self.scope_dyn(UiBuilder::new(), Box::new(add_contents)) } - /// Create a child, add content to it, and then allocate only what was used in the parent `Ui`. + /// Create a scoped child ui, inheriting properties from the parent as specified by the [`UiBuilder`]. + /// In contrast to [`Self::new_child`], this allocates the space used by the child. + /// + /// See also [`Self::scope`] and [`Self::scope_dyn`]. pub fn scope_builder( &mut self, ui_builder: UiBuilder, @@ -2421,7 +2426,7 @@ impl Ui { self.scope_dyn(ui_builder, Box::new(add_contents)) } - /// Create a child, add content to it, and then allocate only what was used in the parent `Ui`. + /// [`Self::scope_builder`] but with dynamic dispatch. pub fn scope_dyn<'c, R>( &mut self, ui_builder: UiBuilder, diff --git a/crates/egui/src/ui_builder.rs b/crates/egui/src/ui_builder.rs index 87786a726..7200af2d9 100644 --- a/crates/egui/src/ui_builder.rs +++ b/crates/egui/src/ui_builder.rs @@ -5,11 +5,13 @@ use crate::ClosableTag; use crate::Ui; use crate::{Id, LayerId, Layout, Rect, Sense, Style, UiStackInfo}; -/// Build a [`Ui`] as the child of another [`Ui`]. +/// The properties specified when creating a top-level or child [`Ui`]. /// /// By default, everything is inherited from the parent, /// except for `max_rect` which by default is set to /// the parent [`Ui::available_rect_before_wrap`]. +/// +/// See also [`Ui::new`] and [`Ui::new_child`] for uses. #[must_use] #[derive(Clone, Default)] pub struct UiBuilder {