scrollbar: Fix Scrollbar inset and remove bar border. (#236)

<img width="920" alt="image"
src="https://github.com/user-attachments/assets/f834a920-8f89-4be8-9100-d2b5e4364449">
This commit is contained in:
Jason Lee 2024-09-11 11:59:37 +08:00 committed by GitHub
parent 77cb8cb448
commit cf551654fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -379,26 +379,26 @@ impl Element for Scrollbar {
) )
}; };
let border_width = px(1.); let border_width = px(0.);
let thumb_bounds = if is_vertical { let thumb_bounds = if is_vertical {
Bounds::from_corners( Bounds::from_corners(
point( point(
bounds.origin.x + inset + border_width, bounds.origin.x + inset + border_width,
bounds.origin.y + thumb_start, bounds.origin.y + thumb_start + inset,
), ),
point( point(
bounds.origin.x + self.width - inset, bounds.origin.x + self.width - inset,
bounds.origin.y + thumb_end, bounds.origin.y + thumb_end - inset,
), ),
) )
} else { } else {
Bounds::from_corners( Bounds::from_corners(
point( point(
bounds.origin.x + thumb_start, bounds.origin.x + thumb_start + inset,
bounds.origin.y + inset + border_width, bounds.origin.y + inset + border_width,
), ),
point( point(
bounds.origin.x + thumb_end, bounds.origin.x + thumb_end - inset,
bounds.origin.y + self.width - inset, bounds.origin.y + self.width - inset,
), ),
) )
@ -420,10 +420,10 @@ impl Element for Scrollbar {
} }
} else { } else {
Edges { Edges {
top: px(1.), top: border_width,
right: px(0.), right: px(0.),
bottom: px(0.), bottom: px(0.),
left: border_width, left: px(0.),
} }
}, },
border_color: bar_border, border_color: bar_border,