diff options
| author | 2019-10-27 01:24:08 +0200 | |
|---|---|---|
| committer | 2019-10-27 01:24:08 +0200 | |
| commit | 09bd2c46c06eba72da40852d82a52e7353cc9e9b (patch) | |
| tree | bf9f9caa19f7f4fd33a1eb99958e0da5c2ad7a23 /native | |
| parent | 719c073fc67c87d6b2da1bc01b74751d3f5e59f0 (diff) | |
| download | iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.tar.gz iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.tar.bz2 iced-09bd2c46c06eba72da40852d82a52e7353cc9e9b.zip | |
Expose scrollable offset properly
Diffstat (limited to '')
| -rw-r--r-- | native/src/widget/scrollable.rs | 10 | 
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) | 
