diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index 202d49d76..d0e624f98 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -2963,7 +2963,7 @@ pub fn font_tweak_ui(ui: &mut Ui, tweak: &mut FontTweak, axes: &[FontVariationAx let mut value = existing.map_or(axis.default, |i| coords.as_ref()[i].1); ui.horizontal(|ui| { - if ui.add(Slider::new(&mut value, axis.range.into())).changed() { + if ui.add(Slider::new(&mut value, axis.range)).changed() { match existing { Some(i) => coords.as_mut()[i].1 = value, None => coords.push(axis.tag, value), diff --git a/crates/egui/src/widgets/slider.rs b/crates/egui/src/widgets/slider.rs index 50b0265f1..b5ce4fc55 100644 --- a/crates/egui/src/widgets/slider.rs +++ b/crates/egui/src/widgets/slider.rs @@ -125,7 +125,11 @@ impl<'a> Slider<'a> { /// /// The `value` given will be clamped to the `range`, /// unless you change this behavior with [`Self::clamping`]. - pub fn new(value: &'a mut Num, range: RangeInclusive) -> Self { + pub fn new( + value: &'a mut Num, + range: impl Into>, + ) -> Self { + let range = range.into(); let range_f64 = range.start().to_f64()..=range.end().to_f64(); let slf = Self::from_get_set(range_f64, move |v: Option| { if let Some(v) = v {