Add widget egui::reset_button

This commit is contained in:
Emil Ernerfeldt
2021-01-02 23:28:10 +01:00
parent fffa5e7795
commit a905c884e8
6 changed files with 24 additions and 31 deletions
+2 -4
View File
@@ -106,7 +106,7 @@ impl DemoWindow {
// ----------------------------------------------------------------------------
#[derive(serde::Deserialize, serde::Serialize)]
#[derive(PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default)]
struct ColorWidgets {
srgba_unmul: [u8; 4],
@@ -129,9 +129,7 @@ impl Default for ColorWidgets {
impl ColorWidgets {
fn ui(&mut self, ui: &mut Ui) {
if ui.button("Reset").clicked {
*self = Default::default();
}
egui::reset_button(ui, self);
ui.label("Egui lets you edit colors stored as either sRGBA or linear RGBA and with or without premultiplied alpha");