diff --git a/egui/src/containers/resize.rs b/egui/src/containers/resize.rs index fcc3c669..519728d2 100644 --- a/egui/src/containers/resize.rs +++ b/egui/src/containers/resize.rs @@ -24,7 +24,7 @@ pub struct Resize { /// If false, we are no enabled resizable: bool, - min_size: Vec2, + pub(crate) min_size: Vec2, default_size: Vec2, diff --git a/egui/src/containers/window.rs b/egui/src/containers/window.rs index b0e2666b..86c6c057 100644 --- a/egui/src/containers/window.rs +++ b/egui/src/containers/window.rs @@ -195,8 +195,7 @@ impl<'open> Window<'open> { let area = area.movable(false); // We move it manually let resize = resize.resizable(false); // We move it manually - - let resize = resize.id(resize_id); + let mut resize = resize.id(resize_id); let frame = frame.unwrap_or_else(|| Frame::window(&ctx.style())); @@ -253,6 +252,7 @@ impl<'open> Window<'open> { &mut collapsing, collapsible, ); + resize.min_size.x = resize.min_size.x.max(title_bar.rect.width()); // Prevent making window smaller than title bar width let content_rect = collapsing .add_contents(&mut frame.content_ui, |ui| { @@ -613,7 +613,7 @@ fn show_title_bar( let title_rect = ui.allocate_space(title_galley.size); if show_close_button { - // Reserve space for close button which will be added later: + // Reserve space for close button which will be added later (once we know our full width): let close_max_x = title_rect.right() + item_spacing.x + button_size + item_spacing.x; let close_max_x = close_max_x.max(ui.rect_finite().right()); let close_rect = Rect::from_min_size(