From 3881d68b7ed568d9fbe7985da2d194647b54e427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 28 May 2025 20:51:01 +0200 Subject: [PATCH] Round translation to integral units in `scrollable` --- widget/src/scrollable.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 69422490..ff366db0 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -1633,20 +1633,24 @@ impl State { ) -> Vector { Vector::new( if let Some(horizontal) = direction.horizontal() { - self.offset_x.translation( - bounds.width, - content_bounds.width, - horizontal.alignment, - ) + self.offset_x + .translation( + bounds.width, + content_bounds.width, + horizontal.alignment, + ) + .round() } else { 0.0 }, if let Some(vertical) = direction.vertical() { - self.offset_y.translation( - bounds.height, - content_bounds.height, - vertical.alignment, - ) + self.offset_y + .translation( + bounds.height, + content_bounds.height, + vertical.alignment, + ) + .round() } else { 0.0 },