bevy/examples/ui
ickshonpe 09df19bcad
Split UI Overflow by axis (#8095)
# Objective

Split the UI overflow enum so that overflow can be set for each axis
separately.

## Solution

Change `Overflow` from an enum to a struct with `x` and `y`
`OverflowAxis` fields, where `OverflowAxis` is an enum with `Clip` and
`Visible` variants. Modify `update_clipping` to calculate clipping for
each axis separately. If only one axis is clipped, the other axis is
given infinite bounds.

<img width="642" alt="overflow"
src="https://user-images.githubusercontent.com/27962798/227592983-568cf76f-7e40-48c4-a511-43c886f5e431.PNG">

---

## Changelog
* Split the UI overflow implementation so overflow can be set for each
axis separately.
* Added the enum `OverflowAxis` with `Clip` and `Visible` variants.
* Changed `Overflow` to a struct with `x` and `y` fields of type
`OverflowAxis`.
* `Overflow` has new methods `visible()` and `hidden()` that replace its
previous `Clip` and `Visible` variants.
* Added `Overflow` helper methods `clip_x()` and `clip_y()` that return
a new `Overflow` value with the given axis clipped.
* Modified `update_clipping` so it calculates clipping for each axis
separately. If a node is only clipped on a single axis, the other axis
is given `-f32::INFINITY` to `f32::INFINITY` clipping bounds.


## Migration Guide

The `Style` property `Overflow` is now a struct with `x` and `y` fields,
that allow for per-axis overflow control.

Use these helper functions to replace the variants of `Overflow`:
* Replace `Overflow::Visible` with  `Overflow::visible()`
* Replace `Overflow::Hidden` with `Overflow::clip()`
2023-04-17 22:23:52 +00:00
..
button.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
flex_layout.rs Rename text_layout example to flex_layout (#7943) 2023-03-22 08:22:56 +00:00
font_atlas_debug.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
grid.rs Fix text measurement algorithm (#8425) 2023-04-17 19:59:42 +00:00
overflow.rs Split UI Overflow by axis (#8095) 2023-04-17 22:23:52 +00:00
overflow_debug.rs Split UI Overflow by axis (#8095) 2023-04-17 22:23:52 +00:00
relative_cursor_position.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
text.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
text_debug.rs Non-breaking change* from UK spellings to US (#8291) 2023-04-08 16:22:46 +00:00
transparency_ui.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
ui.rs Split UI Overflow by axis (#8095) 2023-04-17 22:23:52 +00:00
ui_scaling.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
window_fallthrough.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
z_index.rs Non-breaking change* from UK spellings to US (#8291) 2023-04-08 16:22:46 +00:00