bevy/crates/bevy_ui
Jerome Humbert 960e797388
Add UiRect::px() and UiRect::percent() utils (#8866)
# Objective

Make the UI code more concise.

## Solution

Add two utility methods to make manipulating `UiRect` from code more
concise:
- `UiRect::px()` create a new `UiRect` like the `new()` function, but
with values in logical pixels directly.
- `UiRect::percent()` is similar, with values as percentages.

This saves a lot of typing and makes UI code more compact while
retaining readability.

---

## Changelog

### Added

Added two new constructors `UiRect::px()` and `UiRect::percent()` to
create a new `UiRect` from values directly specified in logical pixels
and percentages, respectively. The argument order is the same as
`UiRect::new()`, but avoids having to repeat `Val::Px` and
`Val::Percent`, respectively.
2023-06-19 14:00:18 +00:00
..
src Add UiRect::px() and UiRect::percent() utils (#8866) 2023-06-19 14:00:18 +00:00
Cargo.toml Add CSS Grid support to bevy_ui (#8026) 2023-04-17 16:21:38 +00:00