diff --git a/egui/src/containers/window.rs b/egui/src/containers/window.rs index bab61ef6..ed89ec4e 100644 --- a/egui/src/containers/window.rs +++ b/egui/src/containers/window.rs @@ -650,7 +650,7 @@ fn show_title_bar( title_label, title_galley, title_rect, - rect: Default::default(), // Will be filled in later + rect: Rect::invalid(), // Will be filled in later } }); diff --git a/egui/src/math/rect.rs b/egui/src/math/rect.rs index d046e404..7234b9da 100644 --- a/egui/src/math/rect.rs +++ b/egui/src/math/rect.rs @@ -5,7 +5,7 @@ use crate::math::*; /// A rectangular region of space. /// /// Normally given in points, e.g. logical pixels. -#[derive(Clone, Copy, Default, Eq, PartialEq)] +#[derive(Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Rect { pub min: Pos2, @@ -30,6 +30,14 @@ impl Rect { } } + /// invalid, NAN filled Rect. + pub fn invalid() -> Self { + Self { + min: pos2(f32::NAN, f32::NAN), + max: pos2(f32::NAN, f32::NAN), + } + } + pub fn from_min_max(min: Pos2, max: Pos2) -> Self { Rect { min, max } } diff --git a/egui/src/widgets/image.rs b/egui/src/widgets/image.rs index 1846e49b..a78e194e 100644 --- a/egui/src/widgets/image.rs +++ b/egui/src/widgets/image.rs @@ -1,6 +1,6 @@ use crate::*; -#[derive(Clone, Copy, Debug, Default)] +#[derive(Clone, Copy, Debug)] pub struct Image { texture_id: TextureId, uv: Rect, @@ -15,8 +15,8 @@ impl Image { texture_id, uv: Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), desired_size, + bg_fill: Default::default(), tint: color::WHITE, - ..Default::default() } }