From 5a1ab9b2b82fb324be5f5885463f6934242ee341 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 26 Aug 2024 15:36:50 +0200 Subject: [PATCH] Add `Slider::max_decimals_opt` (#4953) As mentioned in #4950 I added `max_decimals_opt` to the Slider * Closes * [x] I have followed the instructions in the PR template * [x] I ran the script in `scripts/check.sh` --- crates/egui/src/widgets/slider.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/egui/src/widgets/slider.rs b/crates/egui/src/widgets/slider.rs index 84e47aee..74f792e5 100644 --- a/crates/egui/src/widgets/slider.rs +++ b/crates/egui/src/widgets/slider.rs @@ -279,6 +279,12 @@ impl<'a> Slider<'a> { self } + #[inline] + pub fn max_decimals_opt(mut self, max_decimals: Option) -> Self { + self.max_decimals = max_decimals; + self + } + /// Set an exact number of decimals to display. /// /// Values will also be rounded to this number of decimals.