diff options
author | 2023-10-24 03:18:03 +0200 | |
---|---|---|
committer | 2024-02-02 01:57:03 +0100 | |
commit | a6e91d13d5d43796d0e6bb570fb4f010cf27921a (patch) | |
tree | 209fad24b9cc5549842269d6a1d667aa02215976 /graphics | |
parent | aa41d7656e734b5dae3c19dff87afbc74617a67f (diff) | |
download | iced-a6e91d13d5d43796d0e6bb570fb4f010cf27921a.tar.gz iced-a6e91d13d5d43796d0e6bb570fb4f010cf27921a.tar.bz2 iced-a6e91d13d5d43796d0e6bb570fb4f010cf27921a.zip |
Allow only uniform scaling in `Transformation`
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/transformation.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/graphics/src/transformation.rs b/graphics/src/transformation.rs index 1aeb691e..e2642980 100644 --- a/graphics/src/transformation.rs +++ b/graphics/src/transformation.rs @@ -26,21 +26,16 @@ impl Transformation { Transformation(Mat4::from_translation(Vec3::new(x, y, 0.0))) } - /// Creates a scale transformation. - pub fn scale(x: f32, y: f32) -> Transformation { - Transformation(Mat4::from_scale(Vec3::new(x, y, 1.0))) + /// Creates a uniform scaling transformation. + pub fn scale(scaling: f32) -> Transformation { + Transformation(Mat4::from_scale(Vec3::new(scaling, scaling, 1.0))) } - /// The scale factor on the X axis. - pub fn scale_x(&self) -> f32 { + /// The scale factor of the [`Transformation`]. + pub fn scale_factor(&self) -> f32 { self.0.x_axis.x } - /// The scale factor on the Y axis. - pub fn scale_y(&self) -> f32 { - self.0.y_axis.y - } - /// The translation on the X axis. pub fn translation_x(&self) -> f32 { self.0.w_axis.x |