diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index 8aad2fb8305d1..b4d27c253fd00 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -79,7 +79,7 @@ impl Node { /// Returns the logical pixel coordinates of the UI node, based on its [`GlobalTransform`]. #[inline] pub fn logical_rect(&self, transform: &GlobalTransform) -> Rect { - Rect::from_center_size(transform.translation().truncate(), self.size()) + Rect::from_center_size(transform.translation().truncate(), self.size().max(Vec2::ZERO)) } /// Returns the physical pixel coordinates of the UI node, based on its [`GlobalTransform`] and the scale factor.