summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-27 01:24:08 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-27 01:24:08 +0200
commit09bd2c46c06eba72da40852d82a52e7353cc9e9b (patch)
treebf9f9caa19f7f4fd33a1eb99958e0da5c2ad7a23 /native
parent719c073fc67c87d6b2da1bc01b74751d3f5e59f0 (diff)
downloadiced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.tar.gz
iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.tar.bz2
iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.zip
Expose scrollable offset properly
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/scrollable.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs
index 4644282b..f411915b 100644
--- a/native/src/widget/scrollable.rs
+++ b/native/src/widget/scrollable.rs
@@ -56,12 +56,7 @@ where
Event::Mouse(mouse::Event::WheelScrolled {
delta_y, ..
}) => {
- // TODO: Configurable speed (?)
- self.state.offset = (self.state.offset as i32
- - delta_y.round() as i32 * 15)
- .max(0)
- .min((content_bounds.height - bounds.height) as i32)
- as u32;
+ self.state.scroll(delta_y, bounds, content_bounds);
}
_ => {}
}
@@ -70,7 +65,8 @@ where
let cursor_position = if is_mouse_over {
Point::new(
cursor_position.x,
- cursor_position.y + self.state.offset as f32,
+ cursor_position.y
+ + self.state.offset(bounds, content_bounds) as f32,
)
} else {
Point::new(cursor_position.x, -1.0)