From 2e7cc2548869035710460a714d83f5d2a299b3f3 Mon Sep 17 00:00:00 2001 From: edwloef Date: Thu, 30 Jan 2025 15:00:33 +0100 Subject: [PATCH] fix rectangle snapping --- core/src/rectangle.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index cff33991c0..17f4960226 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -203,7 +203,10 @@ impl Rectangle { } /// Snaps the [`Rectangle`] to __unsigned__ integer coordinates. - pub fn snap(self) -> Option> { + pub fn snap(mut self) -> Option> { + self.width += self.x.fract(); + self.height += self.y.fract(); + let width = self.width as u32; let height = self.height as u32;