Add border_radius to slider rail

This commit is contained in:
Casper Storm 2023-06-01 10:46:33 +02:00
parent ce64dcbfd4
commit 9902e77816
4 changed files with 8 additions and 5 deletions

View file

@ -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.

View file

@ -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,

View file

@ -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,
},
@ -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,
},

View file

@ -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,
},
@ -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,
},