mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
9066d51420
# Objective Adds a better interface for performing mathematical operations with UI unit `Val`. Fixes #6080. ## Solution - Added `try_add` and `try_sub` methods to Val. - Removed the `Add` and `AddAssign` impls for `Val` that introduced unintuitive and bug-prone behaviour. - As a consequence of the prior, ~~changed the `Add` and `Sub` impls for the `Size` struct to take a `(Val, Val)` instead of `Vec2`~~ deleted the `Add` and `Sub` impls for the `Size` struct - Added a `From<(Val, Val)>` impl for the `Size` struct - Added `evaluate(size: f32)` method that converts from `Val::Percent` to `Val::Px`. - Added `try_add_with_size` and `try_sub_with_size` methods to `Val`, which evaluate `Val::Percent` values into `Val::Px` values before adding. --- ## Migration Guide Instead of using the + and - operators, perform calculations on `Val`s using the new `try_add` and `try_sub` methods. Multiplication and division remained unchanged. Also, when adding or subtracting from `Size`, ~~use a `Val` tuple instead of `Vec2`~~ perform the addition on `width` and `height` separately. Co-authored-by: Dawid Piotrowski <41804418+Pietrek14@users.noreply.github.com>
37 lines
1.6 KiB
TOML
37 lines
1.6 KiB
TOML
[package]
|
|
name = "bevy_ui"
|
|
version = "0.9.0-dev"
|
|
edition = "2021"
|
|
description = "A custom ECS-driven UI framework built specifically for Bevy Engine"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["bevy"]
|
|
|
|
[dependencies]
|
|
# bevy
|
|
bevy_app = { path = "../bevy_app", version = "0.9.0-dev" }
|
|
bevy_asset = { path = "../bevy_asset", version = "0.9.0-dev" }
|
|
bevy_core_pipeline = { path = "../bevy_core_pipeline", version = "0.9.0-dev" }
|
|
bevy_derive = { path = "../bevy_derive", version = "0.9.0-dev" }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.9.0-dev" }
|
|
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.9.0-dev" }
|
|
bevy_input = { path = "../bevy_input", version = "0.9.0-dev" }
|
|
bevy_log = { path = "../bevy_log", version = "0.9.0-dev" }
|
|
bevy_math = { path = "../bevy_math", version = "0.9.0-dev" }
|
|
bevy_reflect = { path = "../bevy_reflect", version = "0.9.0-dev", features = [
|
|
"bevy",
|
|
] }
|
|
bevy_render = { path = "../bevy_render", version = "0.9.0-dev" }
|
|
bevy_sprite = { path = "../bevy_sprite", version = "0.9.0-dev" }
|
|
bevy_text = { path = "../bevy_text", version = "0.9.0-dev" }
|
|
bevy_transform = { path = "../bevy_transform", version = "0.9.0-dev" }
|
|
bevy_window = { path = "../bevy_window", version = "0.9.0-dev" }
|
|
bevy_utils = { path = "../bevy_utils", version = "0.9.0-dev" }
|
|
|
|
# other
|
|
taffy = "0.1.0"
|
|
serde = { version = "1", features = ["derive"] }
|
|
smallvec = { version = "1.6", features = ["union", "const_generics"] }
|
|
bytemuck = { version = "1.5", features = ["derive"] }
|
|
thiserror = "1.0.37"
|