From 6576184baed72218005ccd3e0ad008465ad5dbb8 Mon Sep 17 00:00:00 2001 From: Andy Terra <152812+airstrike@users.noreply.github.com> Date: Tue, 28 Jan 2025 11:34:36 -0500 Subject: Move cursor `Transformation` to `mouse::cursor` module --- core/src/mouse/cursor.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'core/src/mouse') 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 for Cursor { + type Output = Self; + + fn mul(self, transformation: Transformation) -> Self { + match self { + Cursor::Unavailable => Cursor::Unavailable, + Cursor::Available(point) => { + Cursor::Available(point * transformation) + } + } + } +} -- cgit