summaryrefslogtreecommitdiffstats
path: root/native/src/widget/slider.rs
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/widget/slider.rs')
-rw-r--r--native/src/widget/slider.rs24
1 files changed, 6 insertions, 18 deletions
diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs
index 69c06140..ba467834 100644
--- a/native/src/widget/slider.rs
+++ b/native/src/widget/slider.rs
@@ -391,7 +391,7 @@ pub fn draw<T, R>(
let offset = if range_start >= range_end {
0.0
} else {
- (bounds.width - handle_width) * (value - range_start)
+ (bounds.width - handle_width / 2.0) * (value - range_start)
/ (range_end - range_start)
};
@@ -402,16 +402,10 @@ pub fn draw<T, R>(
bounds: Rectangle {
x: bounds.x,
y: rail_y - style.rail.width / 2.0,
- width: offset,
+ width: offset + handle_width / 2.0,
height: style.rail.width,
},
- border_radius: [
- style.rail.border_radius,
- 0.0,
- 0.0,
- style.rail.border_radius,
- ]
- .into(),
+ border_radius: Default::default(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
@@ -421,18 +415,12 @@ pub fn draw<T, R>(
renderer.fill_quad(
renderer::Quad {
bounds: Rectangle {
- x: bounds.x + offset,
+ x: bounds.x + offset + handle_width / 2.0,
y: rail_y - style.rail.width / 2.0,
width: bounds.width - offset,
height: style.rail.width,
},
- border_radius: [
- 0.0,
- style.rail.border_radius,
- style.rail.border_radius,
- 0.0,
- ]
- .into(),
+ border_radius: Default::default(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
@@ -442,7 +430,7 @@ pub fn draw<T, R>(
renderer.fill_quad(
renderer::Quad {
bounds: Rectangle {
- x: bounds.x + offset.round(),
+ x: bounds.x + offset,
y: rail_y - handle_height / 2.0,
width: handle_width,
height: handle_height,