summaryrefslogtreecommitdiffstats
path: root/graphics/src/transformation.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-10-24 05:34:03 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-02 02:24:45 +0100
commitf4d66486016076bb339a338bc589645119962d1e (patch)
treebbb9c4d996216893296cf4323857323542d6e757 /graphics/src/transformation.rs
parenta6e91d13d5d43796d0e6bb570fb4f010cf27921a (diff)
downloadiced-f4d66486016076bb339a338bc589645119962d1e.tar.gz
iced-f4d66486016076bb339a338bc589645119962d1e.tar.bz2
iced-f4d66486016076bb339a338bc589645119962d1e.zip
Introduce `with_transformation` to `Renderer` trait
Diffstat (limited to '')
-rw-r--r--core/src/transformation.rs (renamed from graphics/src/transformation.rs)15
1 files changed, 5 insertions, 10 deletions
diff --git a/graphics/src/transformation.rs b/core/src/transformation.rs
index e2642980..b2c488b0 100644
--- a/graphics/src/transformation.rs
+++ b/core/src/transformation.rs
@@ -1,4 +1,4 @@
-use crate::core::{Point, Rectangle, Size, Vector};
+use crate::{Point, Rectangle, Size, Vector};
use glam::{Mat4, Vec3, Vec4};
use std::ops::Mul;
@@ -31,19 +31,14 @@ impl Transformation {
Transformation(Mat4::from_scale(Vec3::new(scaling, scaling, 1.0)))
}
- /// The scale factor of the [`Transformation`].
+ /// Returns the scale factor of the [`Transformation`].
pub fn scale_factor(&self) -> f32 {
self.0.x_axis.x
}
- /// The translation on the X axis.
- pub fn translation_x(&self) -> f32 {
- self.0.w_axis.x
- }
-
- /// The translation on the Y axis.
- pub fn translation_y(&self) -> f32 {
- self.0.w_axis.y
+ /// Returns the translation of the [`Transformation`].
+ pub fn translation(&self) -> Vector {
+ Vector::new(self.0.w_axis.x, self.0.w_axis.y)
}
}