Fix width of horizontal scrollbar in Scrollable
This commit is contained in:
parent
9245423c5d
commit
2c782bbe7a
1 changed files with 6 additions and 6 deletions
|
|
@ -1399,8 +1399,8 @@ impl Scrollbars {
|
||||||
|
|
||||||
// Need to adjust the width of the horizontal scrollbar if the vertical scrollbar
|
// Need to adjust the width of the horizontal scrollbar if the vertical scrollbar
|
||||||
// is present
|
// is present
|
||||||
let scrollbar_y_width = show_scrollbar_y
|
let scrollbar_y_width = y_scrollbar
|
||||||
.map_or(0.0, |v| v.width.max(v.scroller_width) + v.margin);
|
.map_or(0.0, |scrollbar| scrollbar.total_bounds.width);
|
||||||
|
|
||||||
let total_scrollbar_height =
|
let total_scrollbar_height =
|
||||||
width.max(scroller_width) + 2.0 * margin;
|
width.max(scroller_width) + 2.0 * margin;
|
||||||
|
|
@ -1425,12 +1425,12 @@ impl Scrollbars {
|
||||||
|
|
||||||
let ratio = bounds.width / content_bounds.width;
|
let ratio = bounds.width / content_bounds.width;
|
||||||
// min width for easier grabbing with extra wide content
|
// min width for easier grabbing with extra wide content
|
||||||
let scroller_length = (bounds.width * ratio).max(2.0);
|
let scroller_length = (scrollbar_bounds.width * ratio).max(2.0);
|
||||||
let scroller_offset = translation.x * ratio;
|
let scroller_offset =
|
||||||
|
translation.x * ratio * scrollbar_bounds.width / bounds.width;
|
||||||
|
|
||||||
let scroller_bounds = Rectangle {
|
let scroller_bounds = Rectangle {
|
||||||
x: (scrollbar_bounds.x + scroller_offset - scrollbar_y_width)
|
x: (scrollbar_bounds.x + scroller_offset).max(0.0),
|
||||||
.max(0.0),
|
|
||||||
y: bounds.y + bounds.height
|
y: bounds.y + bounds.height
|
||||||
- total_scrollbar_height / 2.0
|
- total_scrollbar_height / 2.0
|
||||||
- scroller_width / 2.0,
|
- scroller_width / 2.0,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue