From 3f2bd145547895ac3bddfe716fbc300b2f3dfc9c Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:40:51 +0900 Subject: [PATCH] Fix: Window::default_pos does not work (#5315) Fix: Window::default_pos does not work Issues: Since `default_size` is not applied to `area`, `style.spacing.default_area_size` is applied, causing problems. * Closes #5314 --- crates/egui/src/containers/window.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index 5929644e..9b5de167 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -288,7 +288,9 @@ impl<'open> Window<'open> { /// Set initial size of the window. #[inline] pub fn default_size(mut self, default_size: impl Into) -> Self { + let default_size: Vec2 = default_size.into(); self.resize = self.resize.default_size(default_size); + self.area = self.area.default_size(default_size); self } @@ -296,6 +298,7 @@ impl<'open> Window<'open> { #[inline] pub fn default_width(mut self, default_width: f32) -> Self { self.resize = self.resize.default_width(default_width); + self.area = self.area.default_width(default_width); self } @@ -303,6 +306,7 @@ impl<'open> Window<'open> { #[inline] pub fn default_height(mut self, default_height: f32) -> Self { self.resize = self.resize.default_height(default_height); + self.area = self.area.default_height(default_height); self }