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 {
Vector::new( Vector::new(
if let Some(horizontal) = direction.horizontal() { if let Some(horizontal) = direction.horizontal() {
self.offset_x.translation( self.offset_x
bounds.width, .translation(
content_bounds.width, bounds.width,
horizontal.alignment, content_bounds.width,
) horizontal.alignment,
)
.round()
} else { } else {
0.0 0.0
}, },
if let Some(vertical) = direction.vertical() { if let Some(vertical) = direction.vertical() {
self.offset_y.translation( self.offset_y
bounds.height, .translation(
content_bounds.height, bounds.height,
vertical.alignment, content_bounds.height,
) vertical.alignment,
)
.round()
} else { } else {
0.0 0.0
}, },