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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

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