Fix scrollbar clipping in Scrollable draw logic

This commit is contained in:
Héctor Ramón Jiménez 2021-10-28 17:55:07 +07:00
parent e42e1e2f57
commit d127dbd08e
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -514,13 +514,19 @@ 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(
Rectangle {
width: bounds.width + 2.0,
height: bounds.height + 2.0,
..bounds
},
|renderer| {
if is_scrollbar_visible { if is_scrollbar_visible {
renderer.fill_rectangle(renderer::Quad { renderer.fill_rectangle(renderer::Quad {
bounds: scrollbar.bounds, bounds: scrollbar.bounds,
background: style background: style.background.unwrap_or(
.background Background::Color(Color::TRANSPARENT),
.unwrap_or(Background::Color(Color::TRANSPARENT)), ),
border_radius: style.border_radius, border_radius: style.border_radius,
border_width: style.border_width, border_width: style.border_width,
border_color: style.border_color, border_color: style.border_color,
@ -539,7 +545,8 @@ where
border_color: style.scroller.border_color, border_color: style.scroller.border_color,
}); });
} }
}); },
);
} else { } else {
self.content.draw( self.content.draw(
renderer, renderer,