Move cursor Transformation to mouse::cursor module
This commit is contained in:
parent
34673fc54f
commit
6576184bae
2 changed files with 16 additions and 15 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
use crate::{Point, Rectangle, Vector};
|
use crate::{Point, Rectangle, Transformation, Vector};
|
||||||
|
|
||||||
|
use std::ops::Mul;
|
||||||
|
|
||||||
/// The mouse cursor state.
|
/// The mouse cursor state.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||||
|
|
@ -50,3 +52,16 @@ impl Cursor {
|
||||||
self.position_over(bounds).is_some()
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use crate::mouse::Cursor;
|
|
||||||
use crate::{Point, Rectangle, Size, Vector};
|
use crate::{Point, Rectangle, Size, Vector};
|
||||||
|
|
||||||
use glam::{Mat4, Vec3, Vec4};
|
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 {
|
impl AsRef<[f32; 16]> for Transformation {
|
||||||
fn as_ref(&self) -> &[f32; 16] {
|
fn as_ref(&self) -> &[f32; 16] {
|
||||||
self.0.as_ref()
|
self.0.as_ref()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue