1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Make slider step account for range start (#3488)

Closes #3483
This commit is contained in:
YgorSouza
2023-11-10 11:17:16 +01:00
committed by GitHub
parent 7e2c65a82a
commit 6326ef18d7

View File

@@ -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);
}