From 51bb4f08a92d5335f29b6cca831ad7e284e9fa26 Mon Sep 17 00:00:00 2001 From: Luc <47307392+LucDrenth@users.noreply.github.com> Date: Tue, 28 Jan 2025 06:34:50 +0100 Subject: [PATCH] expose OverflowAxis::Hidden as Overflow functions (#17528) # Objective expose `OverflowAxis::Hidden` as functions of `Overflow`, just as it is done for `OverflowAxis::Hidden` and `OverflowAxis::Scroll`. --- crates/bevy_ui/src/ui_node.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index 1c764d8470f5f..f1e8c3a263173 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -1064,6 +1064,30 @@ impl Overflow { } } + /// Hide overflowing items on both axes by influencing layout and then clipping + pub const fn hidden() -> Self { + Self { + x: OverflowAxis::Hidden, + y: OverflowAxis::Hidden, + } + } + + /// Hide overflowing items on the x axis by influencing layout and then clipping + pub const fn hidden_x() -> Self { + Self { + x: OverflowAxis::Hidden, + y: OverflowAxis::Visible, + } + } + + /// Hide overflowing items on the y axis by influencing layout and then clipping + pub const fn hidden_y() -> Self { + Self { + x: OverflowAxis::Visible, + y: OverflowAxis::Hidden, + } + } + /// Overflow is visible on both axes pub const fn is_visible(&self) -> bool { self.x.is_visible() && self.y.is_visible()