Skip to content

Commit

Permalink
Make slider step account for range start (#3488)
Browse files Browse the repository at this point in the history
Closes #3483
  • Loading branch information
YgorSouza authored Nov 10, 2023
1 parent 7e2c65a commit 6326ef1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/egui/src/widgets/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6326ef1

Please sign in to comment.