Skip to content

Commit

Permalink
Merge pull request #1844 from tarkah/fix/scrollbar-widths
Browse files Browse the repository at this point in the history
Remove min width 1 from scrollbar & scroller
  • Loading branch information
hecrj authored May 23, 2023
2 parents e31582e + 2932695 commit 8300d86
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions widget/src/scrollable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Pixels>) -> Self {
self.width = width.into().0.max(1.0);
self.width = width.into().0.max(0.0);
self
}

Expand All @@ -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<Pixels>) -> Self {
self.scroller_width = scroller_width.into().0.max(1.0);
self.scroller_width = scroller_width.into().0.max(0.0);
self
}
}
Expand Down Expand Up @@ -811,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 {
Expand All @@ -829,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 {
Expand Down

0 comments on commit 8300d86

Please sign in to comment.