Fix Scrollbar bound calculations in Scrollable
This commit is contained in:
parent
570600ce51
commit
70483e7fdd
1 changed files with 12 additions and 9 deletions
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue