Fix scrollbar clipping in Scrollable draw logic
This commit is contained in:
parent
e42e1e2f57
commit
d127dbd08e
1 changed files with 32 additions and 25 deletions
|
|
@ -514,32 +514,39 @@ where
|
||||||
let is_scrollbar_visible =
|
let is_scrollbar_visible =
|
||||||
style.background.is_some() || style.border_width > 0.0;
|
style.background.is_some() || style.border_width > 0.0;
|
||||||
|
|
||||||
renderer.with_layer(bounds, |renderer| {
|
renderer.with_layer(
|
||||||
if is_scrollbar_visible {
|
Rectangle {
|
||||||
renderer.fill_rectangle(renderer::Quad {
|
width: bounds.width + 2.0,
|
||||||
bounds: scrollbar.bounds,
|
height: bounds.height + 2.0,
|
||||||
background: style
|
..bounds
|
||||||
.background
|
},
|
||||||
.unwrap_or(Background::Color(Color::TRANSPARENT)),
|
|renderer| {
|
||||||
border_radius: style.border_radius,
|
if is_scrollbar_visible {
|
||||||
border_width: style.border_width,
|
renderer.fill_rectangle(renderer::Quad {
|
||||||
border_color: style.border_color,
|
bounds: scrollbar.bounds,
|
||||||
});
|
background: style.background.unwrap_or(
|
||||||
}
|
Background::Color(Color::TRANSPARENT),
|
||||||
|
),
|
||||||
|
border_radius: style.border_radius,
|
||||||
|
border_width: style.border_width,
|
||||||
|
border_color: style.border_color,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if is_mouse_over
|
if is_mouse_over
|
||||||
|| self.state.is_scroller_grabbed()
|
|| self.state.is_scroller_grabbed()
|
||||||
|| is_scrollbar_visible
|
|| is_scrollbar_visible
|
||||||
{
|
{
|
||||||
renderer.fill_rectangle(renderer::Quad {
|
renderer.fill_rectangle(renderer::Quad {
|
||||||
bounds: scrollbar.scroller.bounds,
|
bounds: scrollbar.scroller.bounds,
|
||||||
background: Background::Color(style.scroller.color),
|
background: Background::Color(style.scroller.color),
|
||||||
border_radius: style.scroller.border_radius,
|
border_radius: style.scroller.border_radius,
|
||||||
border_width: style.scroller.border_width,
|
border_width: style.scroller.border_width,
|
||||||
border_color: style.scroller.border_color,
|
border_color: style.scroller.border_color,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
self.content.draw(
|
self.content.draw(
|
||||||
renderer,
|
renderer,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue