Skip to content

Commit e61b5a1

Browse files
authored
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.
1 parent 0be1529 commit e61b5a1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/bevy_ui/src/geometry.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ impl UiRect {
349349
bottom: Val::ZERO,
350350
};
351351

352+
pub const AUTO: Self = Self {
353+
left: Val::Auto,
354+
right: Val::Auto,
355+
top: Val::Auto,
356+
bottom: Val::Auto,
357+
};
358+
352359
/// Creates a new [`UiRect`] from the values specified.
353360
///
354361
/// # Example

0 commit comments

Comments
 (0)