Apply translation to levitated Cursor in scrollable
This commit is contained in:
parent
869891bbf0
commit
a0cfd52d1b
2 changed files with 20 additions and 13 deletions
|
|
@ -75,6 +75,20 @@ impl Cursor {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::ops::Add<Vector> for Cursor {
|
||||
type Output = Self;
|
||||
|
||||
fn add(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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue