Merge pull request #1844 from tarkah/fix/scrollbar-widths

Remove min width 1 from scrollbar & scroller
This commit is contained in:
Héctor Ramón 2023-05-23 04:53:24 +02:00 committed by GitHub
commit 8300d86c24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,9 +128,8 @@ impl Properties {
} }
/// Sets the scrollbar width of the [`Scrollable`] . /// Sets the scrollbar width of the [`Scrollable`] .
/// Silently enforces a minimum width of 1.
pub fn width(mut self, width: impl Into<Pixels>) -> Self { pub fn width(mut self, width: impl Into<Pixels>) -> Self {
self.width = width.into().0.max(1.0); self.width = width.into().0.max(0.0);
self self
} }
@ -141,9 +140,8 @@ impl Properties {
} }
/// Sets the scroller width of the [`Scrollable`] . /// Sets the scroller width of the [`Scrollable`] .
/// Silently enforces a minimum width of 1.
pub fn scroller_width(mut self, scroller_width: impl Into<Pixels>) -> Self { pub fn scroller_width(mut self, scroller_width: impl Into<Pixels>) -> Self {
self.scroller_width = scroller_width.into().0.max(1.0); self.scroller_width = scroller_width.into().0.max(0.0);
self self
} }
} }
@ -811,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 {
@ -829,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 {