Avoid drawing empty quads in widget::scrollable

This commit is contained in:
Héctor Ramón Jiménez 2023-05-23 04:39:41 +02:00
parent 12a57fae5c
commit 29326952b4
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -809,9 +809,11 @@ pub fn draw<Renderer>(
style: Scrollbar,
scrollbar: &internals::Scrollbar| {
//track
if style.background.is_some()
|| (style.border_color != Color::TRANSPARENT
&& style.border_width > 0.0)
if scrollbar.bounds.width > 0.0
&& scrollbar.bounds.height > 0.0
&& (style.background.is_some()
|| (style.border_color != Color::TRANSPARENT
&& style.border_width > 0.0))
{
renderer.fill_quad(
renderer::Quad {
@ -827,9 +829,11 @@ pub fn draw<Renderer>(
}
//thumb
if style.scroller.color != Color::TRANSPARENT
|| (style.scroller.border_color != Color::TRANSPARENT
&& style.scroller.border_width > 0.0)
if scrollbar.scroller.bounds.width > 0.0
&& scrollbar.scroller.bounds.height > 0.0
&& (style.scroller.color != Color::TRANSPARENT
|| (style.scroller.border_color != Color::TRANSPARENT
&& style.scroller.border_width > 0.0))
{
renderer.fill_quad(
renderer::Quad {