Merge pull request #3137 from edwloef/cursor-sub
Implement `Sub<Vector>` for `Cursor`
This commit is contained in:
commit
44e2087fea
1 changed files with 14 additions and 0 deletions
|
|
@ -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 {
|
impl std::ops::Mul<Transformation> for Cursor {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue