From 9902e778167af8d4b108102619ee1ed8d0de0be5 Mon Sep 17 00:00:00 2001 From: Casper Storm Date: Thu, 1 Jun 2023 10:46:33 +0200 Subject: Add border_radius to slider rail --- widget/src/slider.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'widget/src/slider.rs') diff --git a/widget/src/slider.rs b/widget/src/slider.rs index 2851d8c3..c2498b87 100644 --- a/widget/src/slider.rs +++ b/widget/src/slider.rs @@ -403,7 +403,7 @@ pub fn draw( width: offset + handle_width / 2.0, height: style.rail.width, }, - border_radius: Default::default(), + border_radius: style.rail.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, }, @@ -418,7 +418,7 @@ pub fn draw( width: bounds.width - offset - handle_width / 2.0, height: style.rail.width, }, - border_radius: Default::default(), + border_radius: style.rail.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, }, -- cgit From 1e2965d5423fc35943388aa32a6cae2c6b0f2336 Mon Sep 17 00:00:00 2001 From: Casper Storm Date: Thu, 1 Jun 2023 13:30:48 +0200 Subject: only add border radius to the visible part --- widget/src/slider.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'widget/src/slider.rs') diff --git a/widget/src/slider.rs b/widget/src/slider.rs index c2498b87..af6a824f 100644 --- a/widget/src/slider.rs +++ b/widget/src/slider.rs @@ -367,6 +367,7 @@ pub fn draw( } else { style_sheet.active(style) }; + let border_radius: [f32; 4] = style.rail.border_radius.into(); let (handle_width, handle_height, handle_border_radius) = match style.handle.shape { @@ -403,7 +404,8 @@ pub fn draw( width: offset + handle_width / 2.0, height: style.rail.width, }, - border_radius: style.rail.border_radius, + border_radius: [border_radius[0], 0.0, 0.0, border_radius[3]] + .into(), border_width: 0.0, border_color: Color::TRANSPARENT, }, @@ -418,7 +420,8 @@ pub fn draw( width: bounds.width - offset - handle_width / 2.0, height: style.rail.width, }, - border_radius: style.rail.border_radius, + border_radius: [0.0, border_radius[1], border_radius[2], 0.0] + .into(), border_width: 0.0, border_color: Color::TRANSPARENT, }, -- cgit From 66d4decc0c5c6ea787ec482ff6841829dfc7ffba Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 1 Jun 2023 17:27:52 +0200 Subject: Fix `quad` glitch when rounding borders of a `Slider` rail --- widget/src/slider.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'widget/src/slider.rs') diff --git a/widget/src/slider.rs b/widget/src/slider.rs index af6a824f..c2498b87 100644 --- a/widget/src/slider.rs +++ b/widget/src/slider.rs @@ -367,7 +367,6 @@ pub fn draw( } else { style_sheet.active(style) }; - let border_radius: [f32; 4] = style.rail.border_radius.into(); let (handle_width, handle_height, handle_border_radius) = match style.handle.shape { @@ -404,8 +403,7 @@ pub fn draw( width: offset + handle_width / 2.0, height: style.rail.width, }, - border_radius: [border_radius[0], 0.0, 0.0, border_radius[3]] - .into(), + border_radius: style.rail.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, }, @@ -420,8 +418,7 @@ pub fn draw( width: bounds.width - offset - handle_width / 2.0, height: style.rail.width, }, - border_radius: [0.0, border_radius[1], border_radius[2], 0.0] - .into(), + border_radius: style.rail.border_radius, border_width: 0.0, border_color: Color::TRANSPARENT, }, -- cgit