diff options
Diffstat (limited to '')
| -rw-r--r-- | graphics/src/widget/slider.rs | 28 | 
1 files changed, 13 insertions, 15 deletions
| diff --git a/graphics/src/widget/slider.rs b/graphics/src/widget/slider.rs index da8b5a86..99f0a098 100644 --- a/graphics/src/widget/slider.rs +++ b/graphics/src/widget/slider.rs @@ -19,17 +19,13 @@ pub use iced_style::slider::{Handle, HandleShape, Style, StyleSheet};  pub type Slider<'a, T, Message, Backend> =      iced_native::Slider<'a, T, Message, Renderer<Backend>>; -const HANDLE_HEIGHT: f32 = 22.0; -  impl<B> slider::Renderer for Renderer<B>  where      B: Backend,  {      type Style = Box<dyn StyleSheet>; -    fn height(&self) -> u32 { -        30 -    } +    const DEFAULT_HEIGHT: u16 = 22;      fn draw(          &mut self, @@ -81,16 +77,18 @@ where          let (range_start, range_end) = range.into_inner(); -        let (handle_width, handle_height, handle_border_radius) = -            match style.handle.shape { -                HandleShape::Circle { radius } => { -                    (f32::from(radius * 2), f32::from(radius * 2), radius) -                } -                HandleShape::Rectangle { -                    width, -                    border_radius, -                } => (f32::from(width), HANDLE_HEIGHT, border_radius), -            }; +        let (handle_width, handle_height, handle_border_radius) = match style +            .handle +            .shape +        { +            HandleShape::Circle { radius } => { +                (f32::from(radius * 2), f32::from(radius * 2), radius) +            } +            HandleShape::Rectangle { +                width, +                border_radius, +            } => (f32::from(width), f32::from(bounds.height), border_radius), +        };          let handle_offset = (bounds.width - handle_width)              * ((value - range_start) / (range_end - range_start).max(1.0)); | 
