Round translation to integral units in scrollable

This commit is contained in:
Héctor Ramón Jiménez 2025-05-28 20:51:01 +02:00
parent 5929b26722
commit 3881d68b7e
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -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
},