Skip to content

Commit bdeae9e

Browse files
authored
Fix crash in DragValue when only setting min_decimals (#3231)
1 parent ea6bdfc commit bdeae9e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/egui/src/widgets/drag_value.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ impl<'a> Widget for DragValue<'a> {
405405

406406
let auto_decimals = (aim_rad / speed.abs()).log10().ceil().clamp(0.0, 15.0) as usize;
407407
let auto_decimals = auto_decimals + is_slow_speed as usize;
408-
let max_decimals = max_decimals.unwrap_or(auto_decimals + 2);
408+
let max_decimals = max_decimals
409+
.unwrap_or(auto_decimals + 2)
410+
.at_least(min_decimals);
409411
let auto_decimals = auto_decimals.clamp(min_decimals, max_decimals);
410412

411413
let change = ui.input_mut(|input| {

0 commit comments

Comments
 (0)