mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Add ui.group(|ui| { … }) to visually group some widgets within a frame
This commit is contained in:
@@ -21,7 +21,7 @@ impl Frame {
|
||||
/// For when you want to group a few widgets together within a frame.
|
||||
pub fn group(style: &Style) -> Self {
|
||||
Self {
|
||||
margin: Vec2::new(8.0, 8.0),
|
||||
margin: Vec2::new(8.0, 6.0),
|
||||
corner_radius: 4.0,
|
||||
stroke: style.visuals.widgets.noninteractive.bg_stroke,
|
||||
..Default::default()
|
||||
|
||||
@@ -902,6 +902,11 @@ impl Ui {
|
||||
|
||||
/// # Adding Containers / Sub-uis:
|
||||
impl Ui {
|
||||
/// Put into a `Frame::group`, visually grouping the contents together
|
||||
pub fn group<R>(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> R {
|
||||
crate::Frame::group(self.style()).show(self, add_contents)
|
||||
}
|
||||
|
||||
/// Create a child ui. You can use this to temporarily change the Style of a sub-region, for instance.
|
||||
pub fn wrap<R>(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> (R, Response) {
|
||||
let child_rect = self.available_rect_before_wrap();
|
||||
|
||||
Reference in New Issue
Block a user