diff options
author | 2023-09-14 22:59:02 +0200 | |
---|---|---|
committer | 2023-09-14 22:59:02 +0200 | |
commit | ed11b04f6054809ea55ec9b3f0bd221ac2caf9ca (patch) | |
tree | 968a55dc12d9b4115f936d0d29f724f142980340 /widget/src/scrollable.rs | |
parent | bebb2b0252cba7af3641e28a12de2c6db46b8946 (diff) | |
download | iced-ed11b04f6054809ea55ec9b3f0bd221ac2caf9ca.tar.gz iced-ed11b04f6054809ea55ec9b3f0bd221ac2caf9ca.tar.bz2 iced-ed11b04f6054809ea55ec9b3f0bd221ac2caf9ca.zip |
Fix `height` of vertical scroller in `Scrollbar`
Diffstat (limited to 'widget/src/scrollable.rs')
-rw-r--r-- | widget/src/scrollable.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index 7b1d7a30..f92e6223 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -1364,15 +1364,15 @@ impl Scrollbars { let ratio = bounds.height / content_bounds.height; // min height for easier grabbing with super tall content - let scroller_height = (bounds.height * ratio).max(2.0); - let scroller_offset = translation.y * ratio; + let scroller_height = (scrollbar_bounds.height * ratio).max(2.0); + let scroller_offset = + translation.y * ratio * scrollbar_bounds.height / bounds.height; let scroller_bounds = Rectangle { x: bounds.x + bounds.width - total_scrollbar_width / 2.0 - scroller_width / 2.0, - y: (scrollbar_bounds.y + scroller_offset - x_scrollbar_height) - .max(0.0), + y: (scrollbar_bounds.y + scroller_offset).max(0.0), width: scroller_width, height: scroller_height, }; |