fix rectangle snapping
This commit is contained in:
parent
215cee8c82
commit
c1ab626307
2 changed files with 17 additions and 4 deletions
|
|
@ -107,3 +107,13 @@ where
|
|||
write!(f, "Point {{ x: {}, y: {} }}", self.x, self.y)
|
||||
}
|
||||
}
|
||||
|
||||
impl Point<f32> {
|
||||
/// Snaps the [`Point`] to __unsigned__ integer coordinates.
|
||||
pub fn snap(self) -> Point<u32> {
|
||||
Point {
|
||||
x: self.x.round() as u32,
|
||||
y: self.y.round() as u32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue