egui
egui copied to clipboard
Support double clicking widgets to reset to default value out of the box
A lot of desktop apps in the 2D/3D DCC space now support double-clicking a widget to reset it to its default value. It would be great if egui had support for this out of the box.
Probably for grid layout widgets the label could be part of this. I.e. the entire rectangle, colored in alternating shades of gray, that is the widget's backdrop, would be the active area for double click reset to default.
You should already be able to implement this rather easily with:
if ui.add(DragValue::new(&mut value)).double_clicked() {
*value = 0.0; // or whatever the default is
}
and the same for sliders, checkboxes etc. Is that good enough already?