bevy/crates
Peter Hebden 5875ea7db0 Add additional constructors for UiRect to specify values for specific fields (#5988)
# Objective

Often one wants to create a `UiRect` with a value only specifying a single field. These ways are already available, but not the most ergonomic:

```rust
UiRect::new(Val::Undefined, Val::Undefined, Val::Percent(25.0), Val::Undefined)
```
```rust
UiRect {
    top: Val::Percent(25.0),
    ..default()
}
```

## Solution

Introduce 6 new constructors:

- `horizontal`
- `vertical`
- `left`
- `right`
- `top`
- `bottom`

So the above code can be written instead as:

```rust
UiRect::top(Val::Percent(25.0))
```

This solution is similar to the style fields `margin-left`, `padding-top`, etc. that you would see in CSS, from which bevy's UI has other inspiration. Therefore, it should still feel intuitive to users coming from CSS.

---

## Changelog

### Added

- Additional constructors for `UiRect` to specify values for specific fields
2022-09-27 18:11:39 +00:00
..
bevy_animation Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_app Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_asset Remove AssetServer::watch_for_changes() (#5968) 2022-09-19 16:36:38 +00:00
bevy_audio Update rodio requirement from 0.15 to 0.16 (#6020) 2022-09-19 13:56:56 +00:00
bevy_core Swap out num_cpus for std:🧵:available_parallelism (#4970) 2022-09-19 15:46:03 +00:00
bevy_core_pipeline Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_diagnostic Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_dylib Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_dynamic_plugin Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_ecs Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_ecs_compile_fail_tests Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
bevy_encase_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_gilrs Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_gltf Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
bevy_hierarchy Fix some grammatical errors in the docs (#6109) 2022-09-26 21:47:31 +00:00
bevy_input Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_internal Derived Copy trait for bevy_input events, Serialize/Deserialize for events in bevy_input and bevy_windows, PartialEq for events in both, and Eq where possible in both. (#6023) 2022-09-20 18:24:00 +00:00
bevy_log Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_macro_utils Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_math Expose mint feature in bevy_math/glam (#5857) 2022-09-03 03:02:04 +00:00
bevy_mikktspace Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_pbr Fix some outdated file reference comments in bevy_pbr (#6111) 2022-09-27 17:51:12 +00:00
bevy_ptr Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_reflect Make arrays behave like lists in reflection (#5987) 2022-09-27 18:11:38 +00:00
bevy_render add support for .comp glsl shaders (#6084) 2022-09-27 01:30:40 +00:00
bevy_scene Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_sprite Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_tasks Mark Task as #[must_use] (#6068) 2022-09-22 17:21:16 +00:00
bevy_text Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_time Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_transform Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
bevy_ui Add additional constructors for UiRect to specify values for specific fields (#5988) 2022-09-27 18:11:39 +00:00
bevy_utils Remove Sync bound from Local (#5483) 2022-09-12 04:15:55 +00:00
bevy_window Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
bevy_winit disable window pre creation for ios (#5883) 2022-09-06 15:06:17 +00:00