From e61b5a1d677d68da026082ae693a1828fe256b23 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Mon, 17 Mar 2025 18:24:21 +0000 Subject: [PATCH] `UiRect::AUTO` (#18359) # Objective Add a `UiRect::AUTO` const which is a `UiRect` with all its edge values set to `Val::Auto`. IIRC `UiRect`'s default for its fields a few versions ago was `Val::Auto` because positions were represented using a `UiRect` and they required `Val::Auto` as a default. Then when position was split up and the `UiRect` default was changed, we forgot add a `UiRect::AUTO` const. --- crates/bevy_ui/src/geometry.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/bevy_ui/src/geometry.rs b/crates/bevy_ui/src/geometry.rs index a5749e467a..79ead6ab78 100644 --- a/crates/bevy_ui/src/geometry.rs +++ b/crates/bevy_ui/src/geometry.rs @@ -349,6 +349,13 @@ impl UiRect { bottom: Val::ZERO, }; + pub const AUTO: Self = Self { + left: Val::Auto, + right: Val::Auto, + top: Val::Auto, + bottom: Val::Auto, + }; + /// Creates a new [`UiRect`] from the values specified. /// /// # Example