Skip to content

Commit

Permalink
Merge pull request #1892 from casperstorm/feat/slider-rail-border-radius
Browse files Browse the repository at this point in the history
Add `border_radius` to slider rail
  • Loading branch information
hecrj authored Jun 1, 2023
2 parents 4474866 + 66d4dec commit b353767
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
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
5 changes: 3 additions & 2 deletions 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,
width: 4.0,
border_radius: 2.0.into(),
},
handle: slider::Handle {
color: palette.background.base.color,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ pub fn draw<T, R>(
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,
},
Expand All @@ -418,7 +418,7 @@ pub fn draw<T, R>(
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,
},
Expand Down
4 changes: 2 additions & 2 deletions widget/src/vertical_slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ pub fn draw<T, R>(
width: style.rail.width,
height: offset + handle_width / 2.0,
},
border_radius: Default::default(),
border_radius: style.rail.border_radius,
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Expand All @@ -416,7 +416,7 @@ pub fn draw<T, R>(
width: style.rail.width,
height: bounds.height - offset - handle_width / 2.0,
},
border_radius: Default::default(),
border_radius: style.rail.border_radius,
border_width: 0.0,
border_color: Color::TRANSPARENT,
},
Expand Down

0 comments on commit b353767

Please sign in to comment.