Skip to content

Commit

Permalink
Fix: Window::default_pos does not work (#5315)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rustbasic authored Oct 29, 2024
1 parent 9891648 commit 3f2bd14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/egui/src/containers/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,25 @@ impl<'open> Window<'open> {
/// Set initial size of the window.
#[inline]
pub fn default_size(mut self, default_size: impl Into<Vec2>) -> 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
}

/// Set initial width of the window.
#[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
}

/// Set initial height of the window.
#[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
}

Expand Down

0 comments on commit 3f2bd14

Please sign in to comment.