diff options
author | 2023-02-07 19:27:03 +0100 | |
---|---|---|
committer | 2023-02-17 15:48:35 +0100 | |
commit | 70483e7fdd44e168143bc1252a167c645a5ab9b9 (patch) | |
tree | 71c98aa3735226f425b140f21ead0bba830163d1 /native | |
parent | 570600ce513e7e02b23c1da8322c68fbb876d1b0 (diff) | |
download | iced-70483e7fdd44e168143bc1252a167c645a5ab9b9.tar.gz iced-70483e7fdd44e168143bc1252a167c645a5ab9b9.tar.bz2 iced-70483e7fdd44e168143bc1252a167c645a5ab9b9.zip |
Fix `Scrollbar` bound calculations in `Scrollable`
Diffstat (limited to 'native')
-rw-r--r-- | native/src/widget/scrollable.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index e084d4b0..c1df8c39 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -1116,8 +1116,9 @@ impl Scrollbars { // Bounds of just the scrollbar let scrollbar_bounds = Rectangle { - x: bounds.x + bounds.width - total_scrollbar_width / 2.0 - + width / 2.0, + x: bounds.x + bounds.width + - total_scrollbar_width / 2.0 + - width / 2.0, y: bounds.y, width, height: (bounds.height - x_scrollbar_height).max(0.0), @@ -1129,8 +1130,9 @@ impl Scrollbars { let scroller_offset = offset.y * ratio; let scroller_bounds = Rectangle { - x: bounds.x + bounds.width - total_scrollbar_width / 2.0 - + scroller_width / 2.0, + 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), width: scroller_width, @@ -1175,8 +1177,9 @@ impl Scrollbars { // Bounds of just the scrollbar let scrollbar_bounds = Rectangle { x: bounds.x, - y: bounds.y + bounds.height - total_scrollbar_height / 2.0 - + width / 2.0, + y: bounds.y + bounds.height + - total_scrollbar_height / 2.0 + - width / 2.0, width: (bounds.width - scrollbar_y_width).max(0.0), height: width, }; @@ -1189,9 +1192,9 @@ impl Scrollbars { let scroller_bounds = Rectangle { x: (scrollbar_bounds.x + scroller_offset - scrollbar_y_width) .max(0.0), - y: bounds.y + bounds.height - total_scrollbar_height / 2.0 - + scroller_width / 2.0, - + y: bounds.y + bounds.height + - total_scrollbar_height / 2.0 + - scroller_width / 2.0, width: scroller_length, height: scroller_width, }; |