Don't start dragging until you move to 2px

This commit is contained in:
Nathan Sobo 2023-10-23 16:20:01 +02:00
parent 239b0c2f71
commit 38a7b39070
2 changed files with 10 additions and 3 deletions

View file

@ -7,9 +7,7 @@ use std::{
ops::{Add, Div, Mul, MulAssign, Sub},
};
#[derive(
Refineable, Default, Add, AddAssign, Sub, SubAssign, Copy, Debug, PartialEq, Eq, Hash,
)]
#[derive(Refineable, Default, Add, AddAssign, Sub, SubAssign, Copy, Debug, PartialEq, Eq, Hash)]
#[refineable(debug)]
#[repr(C)]
pub struct Point<T: Default + Clone + Debug> {
@ -41,6 +39,10 @@ impl Point<Pixels> {
y: self.y.scale(factor),
}
}
pub fn magnitude(&self) -> f64 {
((self.x.0.powi(2) + self.y.0.powi(2)) as f64).sqrt()
}
}
impl<T, Rhs> Mul<Rhs> for Point<T>