forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# 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.
- Loading branch information
Showing
2 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters