1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-03 23:30:04 -04:00

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

View File

@@ -2,7 +2,7 @@ use egui::*;
use std::f64::INFINITY;
/// Showcase sliders
#[derive(serde::Deserialize, serde::Serialize)]
#[derive(PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default)]
pub struct Sliders {
pub min: f64,
@@ -108,8 +108,6 @@ impl Sliders {
ui.checkbox(smart_aim, "Smart Aim");
ui.label("Smart Aim will guide you towards round values when you drag the slider so you you are more likely to hit 250 than 247.23");
if ui.button("Reset slider demo").clicked {
*self = Default::default();
}
egui::reset_button(ui, self);
}
}