From 12a57fae5c4a8cf24976c551a64753b5da32ee30 Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Wed, 10 May 2023 17:09:29 -0700 Subject: Remove min width 1 from scrollbar & scroller --- widget/src/scrollable.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index fd51a6a8..c3478493 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -128,9 +128,8 @@ impl Properties { } /// Sets the scrollbar width of the [`Scrollable`] . - /// Silently enforces a minimum width of 1. pub fn width(mut self, width: impl Into) -> Self { - self.width = width.into().0.max(1.0); + self.width = width.into().0.max(0.0); self } @@ -141,9 +140,8 @@ impl Properties { } /// Sets the scroller width of the [`Scrollable`] . - /// Silently enforces a minimum width of 1. pub fn scroller_width(mut self, scroller_width: impl Into) -> Self { - self.scroller_width = scroller_width.into().0.max(1.0); + self.scroller_width = scroller_width.into().0.max(0.0); self } } -- cgit From 29326952b420c22c34a5a1315e8f8a1ce77311ef Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 23 May 2023 04:39:41 +0200 Subject: Avoid drawing empty quads in `widget::scrollable` --- widget/src/scrollable.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs index c3478493..af5424c0 100644 --- a/widget/src/scrollable.rs +++ b/widget/src/scrollable.rs @@ -809,9 +809,11 @@ pub fn draw( 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( } //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 { -- cgit