Fix: integer DragValue could sometimes not reach all values
Fixes https://github.com/emilk/egui/issues/256
This commit is contained in:
parent
1bb100d766
commit
246ab55a7f
1 changed files with 2 additions and 5 deletions
|
@ -263,14 +263,11 @@ impl<'a> Widget for DragValue<'a> {
|
||||||
.flatten();
|
.flatten();
|
||||||
let stored_value = stored_value.unwrap_or(value);
|
let stored_value = stored_value.unwrap_or(value);
|
||||||
let stored_value = stored_value + delta_value as f64;
|
let stored_value = stored_value + delta_value as f64;
|
||||||
let stored_value = clamp_to_range(stored_value, clamp_range.clone());
|
|
||||||
|
|
||||||
let rounded_new_value = stored_value;
|
|
||||||
|
|
||||||
let aim_delta = aim_rad * speed;
|
let aim_delta = aim_rad * speed;
|
||||||
let rounded_new_value = emath::smart_aim::best_in_range_f64(
|
let rounded_new_value = emath::smart_aim::best_in_range_f64(
|
||||||
rounded_new_value - aim_delta,
|
stored_value - aim_delta,
|
||||||
rounded_new_value + aim_delta,
|
stored_value + aim_delta,
|
||||||
);
|
);
|
||||||
let rounded_new_value =
|
let rounded_new_value =
|
||||||
emath::round_to_decimals(rounded_new_value, auto_decimals);
|
emath::round_to_decimals(rounded_new_value, auto_decimals);
|
||||||
|
|
Loading…
Reference in a new issue