Value of DragValue
correctly clamped (#405)
* Update drag_value.rs * `value` → `old_value`
This commit is contained in:
parent
dd4ac43b13
commit
de02f7d042
1 changed files with 6 additions and 3 deletions
|
@ -220,8 +220,11 @@ impl<'a> Widget for DragValue<'a> {
|
||||||
let is_slow_speed =
|
let is_slow_speed =
|
||||||
ui.input().modifiers.shift_only() && ui.memory().is_being_dragged(ui.next_auto_id());
|
ui.input().modifiers.shift_only() && ui.memory().is_being_dragged(ui.next_auto_id());
|
||||||
|
|
||||||
let value = get(&mut get_set_value);
|
let old_value = get(&mut get_set_value);
|
||||||
let value = clamp_to_range(value, clamp_range.clone());
|
let value = clamp_to_range(old_value, clamp_range.clone());
|
||||||
|
if old_value != value {
|
||||||
|
set(&mut get_set_value, value);
|
||||||
|
}
|
||||||
let aim_rad = ui.input().aim_radius() as f64;
|
let aim_rad = ui.input().aim_radius() as f64;
|
||||||
|
|
||||||
let auto_decimals = (aim_rad / speed.abs()).log10().ceil().clamp(0.0, 15.0) as usize;
|
let auto_decimals = (aim_rad / speed.abs()).log10().ceil().clamp(0.0, 15.0) as usize;
|
||||||
|
@ -334,7 +337,7 @@ impl<'a> Widget for DragValue<'a> {
|
||||||
response
|
response
|
||||||
};
|
};
|
||||||
|
|
||||||
response.changed = get(&mut get_set_value) != value;
|
response.changed = get(&mut get_set_value) != old_value;
|
||||||
|
|
||||||
response.widget_info(|| WidgetInfo::drag_value(value));
|
response.widget_info(|| WidgetInfo::drag_value(value));
|
||||||
response
|
response
|
||||||
|
|
Loading…
Reference in a new issue