diff options
author | 2019-11-02 01:46:45 +0100 | |
---|---|---|
committer | 2019-11-02 01:46:45 +0100 | |
commit | 85dab04965940f15cf0e9879e296f67235a3775c (patch) | |
tree | 8d9e4614d338aee503f15e47564bc0d75c433caf /native | |
parent | 58d04cadef020412375f2adc5fd96bfa10ec4692 (diff) | |
download | iced-85dab04965940f15cf0e9879e296f67235a3775c.tar.gz iced-85dab04965940f15cf0e9879e296f67235a3775c.tar.bz2 iced-85dab04965940f15cf0e9879e296f67235a3775c.zip |
Scale scrollbar movement by content ratio
Diffstat (limited to 'native')
-rw-r--r-- | native/src/widget/scrollable.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 8a82be4f..de4c749c 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -102,8 +102,11 @@ where if let Some(scrollbar_grabbed_at) = self.state.scrollbar_grabbed_at { + let ratio = content_bounds.height / bounds.height; + let delta = scrollbar_grabbed_at.y - cursor_position.y; + self.state.scroll( - scrollbar_grabbed_at.y - cursor_position.y, + delta * ratio, bounds, content_bounds, ); |