summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer/widget/slider.rs
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src/renderer/widget/slider.rs')
-rw-r--r--wgpu/src/renderer/widget/slider.rs58
1 files changed, 26 insertions, 32 deletions
diff --git a/wgpu/src/renderer/widget/slider.rs b/wgpu/src/renderer/widget/slider.rs
index c73a4e56..386decb5 100644
--- a/wgpu/src/renderer/widget/slider.rs
+++ b/wgpu/src/renderer/widget/slider.rs
@@ -29,8 +29,10 @@ impl slider::Renderer for Renderer {
width: bounds.width,
height: 2.0,
},
- background: Color::from_rgb(0.6, 0.6, 0.6).into(),
+ background: Background::Color([0.6, 0.6, 0.6, 0.5].into()),
border_radius: 0,
+ border_width: 0,
+ border_color: Color::TRANSPARENT,
},
Primitive::Quad {
bounds: Rectangle {
@@ -41,6 +43,8 @@ impl slider::Renderer for Renderer {
},
background: Background::Color(Color::WHITE),
border_radius: 0,
+ border_width: 0,
+ border_color: Color::TRANSPARENT,
},
);
@@ -49,41 +53,31 @@ impl slider::Renderer for Renderer {
let handle_offset = (bounds.width - HANDLE_WIDTH)
* ((value - range_start) / (range_end - range_start).max(1.0));
- let (handle_border, handle) = (
- Primitive::Quad {
- bounds: Rectangle {
- x: bounds.x + handle_offset.round() - 1.0,
- y: rail_y - HANDLE_HEIGHT / 2.0 - 1.0,
- width: HANDLE_WIDTH + 2.0,
- height: HANDLE_HEIGHT + 2.0,
- },
- background: Color::from_rgb(0.6, 0.6, 0.6).into(),
- border_radius: 5,
- },
- Primitive::Quad {
- bounds: Rectangle {
- x: bounds.x + handle_offset.round(),
- y: rail_y - HANDLE_HEIGHT / 2.0,
- width: HANDLE_WIDTH,
- height: HANDLE_HEIGHT,
- },
- background: Background::Color(
- if is_dragging {
- [0.85, 0.85, 0.85]
- } else if is_mouse_over {
- [0.90, 0.90, 0.90]
- } else {
- [0.95, 0.95, 0.95]
- }
- .into(),
- ),
- border_radius: 4,
+ let handle = Primitive::Quad {
+ bounds: Rectangle {
+ x: bounds.x + handle_offset.round(),
+ y: rail_y - HANDLE_HEIGHT / 2.0,
+ width: HANDLE_WIDTH,
+ height: HANDLE_HEIGHT,
},
- );
+ background: Background::Color(
+ if is_dragging {
+ [0.85, 0.85, 0.85]
+ } else if is_mouse_over {
+ [0.90, 0.90, 0.90]
+ } else {
+ [0.95, 0.95, 0.95]
+ }
+ .into(),
+ ),
+ border_radius: 4,
+ border_width: 1,
+ border_color: Color::from_rgb(0.6, 0.6, 0.6),
+ };
(
Primitive::Group {
- primitives: vec![rail_top, rail_bottom, handle_border, handle],
+ primitives: vec![rail_top, rail_bottom, handle],
},
if is_dragging {
MouseCursor::Grabbing