DragValue: fix crash for speed==0.0 (#216)
This commit is contained in:
parent
f07f9bf5bd
commit
6fb4e19e9e
1 changed files with 1 additions and 1 deletions
|
@ -198,7 +198,7 @@ impl<'a> Widget for DragValue<'a> {
|
||||||
let value = get(&mut get_set_value);
|
let value = get(&mut get_set_value);
|
||||||
let value = clamp(value, clamp_range.clone());
|
let value = clamp(value, clamp_range.clone());
|
||||||
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().at_least(0.0) as usize;
|
let auto_decimals = clamp((aim_rad / speed.abs()).log10().ceil(), 0.0..=15.0) as usize;
|
||||||
let max_decimals = max_decimals.unwrap_or(auto_decimals + 2);
|
let max_decimals = max_decimals.unwrap_or(auto_decimals + 2);
|
||||||
let auto_decimals = clamp(auto_decimals, min_decimals..=max_decimals);
|
let auto_decimals = clamp(auto_decimals, min_decimals..=max_decimals);
|
||||||
let value_text = if value == 0.0 {
|
let value_text = if value == 0.0 {
|
||||||
|
|
Loading…
Reference in a new issue