Skip to content

Commit

Permalink
Fix crash in DragValue when only setting min_decimals (#3231)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk authored Aug 11, 2023
1 parent ea6bdfc commit bdeae9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/egui/src/widgets/drag_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ impl<'a> Widget for DragValue<'a> {

let auto_decimals = (aim_rad / speed.abs()).log10().ceil().clamp(0.0, 15.0) as usize;
let auto_decimals = auto_decimals + is_slow_speed as usize;
let max_decimals = max_decimals.unwrap_or(auto_decimals + 2);
let max_decimals = max_decimals
.unwrap_or(auto_decimals + 2)
.at_least(min_decimals);
let auto_decimals = auto_decimals.clamp(min_decimals, max_decimals);

let change = ui.input_mut(|input| {
Expand Down

0 comments on commit bdeae9e

Please sign in to comment.