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