diff options
| author | 2025-01-28 11:34:36 -0500 | |
|---|---|---|
| committer | 2025-01-28 11:34:36 -0500 | |
| commit | 6576184baed72218005ccd3e0ad008465ad5dbb8 (patch) | |
| tree | fb0983827d94d8dd4e72a6f0889f15334bfd571a /core | |
| parent | 34673fc54f3a2dd7c7f91a0b82ea312b1d01c83e (diff) | |
| download | iced-6576184baed72218005ccd3e0ad008465ad5dbb8.tar.gz iced-6576184baed72218005ccd3e0ad008465ad5dbb8.tar.bz2 iced-6576184baed72218005ccd3e0ad008465ad5dbb8.zip | |
Move cursor `Transformation` to `mouse::cursor` module
Diffstat (limited to '')
| -rw-r--r-- | core/src/mouse/cursor.rs | 17 | ||||
| -rw-r--r-- | core/src/transformation.rs | 14 | 
2 files changed, 16 insertions, 15 deletions
| diff --git a/core/src/mouse/cursor.rs b/core/src/mouse/cursor.rs index 203526e9..616cd315 100644 --- a/core/src/mouse/cursor.rs +++ b/core/src/mouse/cursor.rs @@ -1,4 +1,6 @@ -use crate::{Point, Rectangle, Vector}; +use crate::{Point, Rectangle, Transformation, Vector}; + +use std::ops::Mul;  /// The mouse cursor state.  #[derive(Debug, Clone, Copy, PartialEq, Default)] @@ -50,3 +52,16 @@ impl Cursor {          self.position_over(bounds).is_some()      }  } + +impl Mul<Transformation> for Cursor { +    type Output = Self; + +    fn mul(self, transformation: Transformation) -> Self { +        match self { +            Cursor::Unavailable => Cursor::Unavailable, +            Cursor::Available(point) => { +                Cursor::Available(point * transformation) +            } +        } +    } +} diff --git a/core/src/transformation.rs b/core/src/transformation.rs index 735fd9c4..74183147 100644 --- a/core/src/transformation.rs +++ b/core/src/transformation.rs @@ -1,4 +1,3 @@ -use crate::mouse::Cursor;  use crate::{Point, Rectangle, Size, Vector};  use glam::{Mat4, Vec3, Vec4}; @@ -107,19 +106,6 @@ impl Mul<Transformation> for Rectangle {      }  } -impl Mul<Transformation> for Cursor { -    type Output = Self; - -    fn mul(self, transformation: Transformation) -> Self { -        match self { -            Cursor::Unavailable => Cursor::Unavailable, -            Cursor::Available(point) => { -                Cursor::Available(point * transformation) -            } -        } -    } -} -  impl AsRef<[f32; 16]> for Transformation {      fn as_ref(&self) -> &[f32; 16] {          self.0.as_ref() | 
