Implement scroll_by operation for scrollable

`scroll_by` allows scrolling an absolute offset
that is applied to the current scrolling position.
This commit is contained in:
lufte 2024-05-10 18:50:10 -03:00 committed by Héctor Ramón Jiménez
parent 44235f0c0b
commit e102e89c6a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 157 additions and 36 deletions

View file

@ -20,6 +20,17 @@ impl Vector {
pub const ZERO: Self = Self::new(0.0, 0.0);
}
impl<T> std::ops::Neg for Vector<T>
where
T: std::ops::Neg<Output = T>,
{
type Output = Self;
fn neg(self) -> Self::Output {
Self::new(-self.x, -self.y)
}
}
impl<T> std::ops::Add for Vector<T>
where
T: std::ops::Add<Output = T>,