Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions style/src/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub struct Rail {
pub colors: (Color, Color),
/// The width of the stroke of a slider rail.
pub width: f32,
/// The border radius of the corners of the rail.
pub border_radius: BorderRadius,
}

/// The appearance of the handle of a slider.
Expand Down
3 changes: 2 additions & 1 deletion style/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,10 @@ impl slider::StyleSheet for Theme {
rail: slider::Rail {
colors: (
palette.primary.base.color,
palette.primary.base.color,
palette.secondary.base.color,
),
width: 2.0,
border_radius: Default::default(),
},
handle: slider::Handle {
color: palette.background.base.color,
Expand Down
7 changes: 5 additions & 2 deletions widget/src/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ pub fn draw<T, R>(
} 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 {
Expand Down Expand Up @@ -403,7 +404,8 @@ pub fn draw<T, R>(
width: offset + handle_width / 2.0,
height: style.rail.width,
},
border_radius: Default::default(),
border_radius: [border_radius[0], 0.0, 0.0, border_radius[3]]
.into(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Expand All @@ -418,7 +420,8 @@ pub fn draw<T, R>(
width: bounds.width - offset - handle_width / 2.0,
height: style.rail.width,
},
border_radius: Default::default(),
border_radius: [0.0, border_radius[1], border_radius[2], 0.0]
.into(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Expand Down
7 changes: 5 additions & 2 deletions widget/src/vertical_slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ pub fn draw<T, R>(
} 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 {
Expand Down Expand Up @@ -401,7 +402,8 @@ pub fn draw<T, R>(
width: style.rail.width,
height: offset + handle_width / 2.0,
},
border_radius: Default::default(),
border_radius: [border_radius[0], border_radius[1], 0.0, 0.0]
.into(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Expand All @@ -416,7 +418,8 @@ pub fn draw<T, R>(
width: style.rail.width,
height: bounds.height - offset - handle_width / 2.0,
},
border_radius: Default::default(),
border_radius: [0.0, 0.0, border_radius[2], border_radius[3]]
.into(),
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Expand Down