From 6326ef18d70caf6652fe664504c97daea8b91bd0 Mon Sep 17 00:00:00 2001 From: YgorSouza <43298013+YgorSouza@users.noreply.github.com> Date: Fri, 10 Nov 2023 11:17:16 +0100 Subject: [PATCH] Make slider step account for range start (#3488) Closes #3483 --- crates/egui/src/widgets/slider.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/widgets/slider.rs b/crates/egui/src/widgets/slider.rs index 182019b95dc..07c4f410a2d 100644 --- a/crates/egui/src/widgets/slider.rs +++ b/crates/egui/src/widgets/slider.rs @@ -508,7 +508,8 @@ impl<'a> Slider<'a> { value = emath::round_to_decimals(value, max_decimals); } if let Some(step) = self.step { - value = (value / step).round() * step; + let start = *self.range.start(); + value = start + ((value - start) / step).round() * step; } set(&mut self.get_set_value, value); }