Implement Sub<Vector> for Cursor

This commit is contained in:
edwloef 2025-12-04 17:16:55 +01:00
parent 4cef837e45
commit d83731e1e5
No known key found for this signature in database

View file

@ -89,6 +89,20 @@ impl std::ops::Add<Vector> for Cursor {
}
}
impl std::ops::Sub<Vector> for Cursor {
type Output = Self;
fn sub(self, translation: Vector) -> Self::Output {
match self {
Cursor::Available(point) => Cursor::Available(point - translation),
Cursor::Levitating(point) => {
Cursor::Levitating(point - translation)
}
Cursor::Unavailable => Cursor::Unavailable,
}
}
}
impl std::ops::Mul<Transformation> for Cursor {
type Output = Self;