summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-05-23 04:53:24 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-23 04:53:24 +0200
commit8300d86c242aa3147ec97b2820f774048c285ae8 (patch)
tree4a3f1fe795d3ce8e3625e1648889fc9b2cb688b4
parente31582e59efed3ffc775f2ce12e14dd6c4ec343f (diff)
parent29326952b420c22c34a5a1315e8f8a1ce77311ef (diff)
downloadiced-8300d86c242aa3147ec97b2820f774048c285ae8.tar.gz
iced-8300d86c242aa3147ec97b2820f774048c285ae8.tar.bz2
iced-8300d86c242aa3147ec97b2820f774048c285ae8.zip
Merge pull request #1844 from tarkah/fix/scrollbar-widths
Remove min width 1 from scrollbar & scroller
-rw-r--r--widget/src/scrollable.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index fd51a6a8..af5424c0 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<Pixels>) -> 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<Pixels>) -> Self {
- self.scroller_width = scroller_width.into().0.max(1.0);
+ self.scroller_width = scroller_width.into().0.max(0.0);
self
}
}
@@ -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 {
@@ -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 {