Skip to content

Commit

Permalink
fix rectangle snapping
Browse files Browse the repository at this point in the history
  • Loading branch information
edwloef committed Jan 30, 2025
1 parent f2c9b6b commit 2e7cc25
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/rectangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ impl Rectangle<f32> {
}

/// Snaps the [`Rectangle`] to __unsigned__ integer coordinates.
pub fn snap(self) -> Option<Rectangle<u32>> {
pub fn snap(mut self) -> Option<Rectangle<u32>> {
self.width += self.x.fract();
self.height += self.y.fract();

let width = self.width as u32;
let height = self.height as u32;

Expand Down

0 comments on commit 2e7cc25

Please sign in to comment.