diff --git a/crates/bevy_ui/src/geometry.rs b/crates/bevy_ui/src/geometry.rs index 7e48abe7be207..80bd8a4b697e1 100644 --- a/crates/bevy_ui/src/geometry.rs +++ b/crates/bevy_ui/src/geometry.rs @@ -249,6 +249,18 @@ impl Neg for Val { } } +impl From for Val { + fn from(value: f32) -> Self { + Val::Px(value) + } +} + +impl From for Val { + fn from(value: i32) -> Self { + Val::Px(value as f32) + } +} + #[derive(Debug, Eq, PartialEq, Clone, Copy, Error)] pub enum ValArithmeticError { #[error("the given variant of Val is not evaluable (non-numeric)")]