diff --git a/crates/bevy_math/src/aspect_ratio.rs b/crates/bevy_math/src/aspect_ratio.rs index 1d18c690b8..08e47e91ba 100644 --- a/crates/bevy_math/src/aspect_ratio.rs +++ b/crates/bevy_math/src/aspect_ratio.rs @@ -1,5 +1,7 @@ //! Provides a simple aspect ratio struct to help with calculations. +use crate::Vec2; + /// An `AspectRatio` is the ratio of width to height. pub struct AspectRatio(f32); @@ -17,6 +19,13 @@ impl AspectRatio { } } +impl From for AspectRatio { + #[inline] + fn from(value: Vec2) -> Self { + Self::new(value.x, value.y) + } +} + impl From for f32 { #[inline] fn from(aspect_ratio: AspectRatio) -> Self {