Skip to content

Commit

Permalink
expose OverflowAxis::Hidden as Overflow functions (#17528)
Browse files Browse the repository at this point in the history
# Objective
expose `OverflowAxis::Hidden` as functions of `Overflow`, just as it is
done for `OverflowAxis::Hidden` and `OverflowAxis::Scroll`.
  • Loading branch information
LucDrenth authored Jan 28, 2025
1 parent 203d0b4 commit 51bb4f0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions crates/bevy_ui/src/ui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 51bb4f0

Please sign in to comment.