Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7d0f5ceea
|
+6
-1
@@ -10,8 +10,9 @@ use egui::{
|
||||
Align, Button, Color32, FontData, FontDefinitions, PointerButton, RichText, ScrollArea, Stroke,
|
||||
};
|
||||
|
||||
/// We derive Deserialize/Serialize so we can persist app state on shutdown.
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[serde(default)]
|
||||
#[serde(default)] // if we add new fields, give them default values when deserializing old state
|
||||
pub struct App {
|
||||
preferences: Preferences,
|
||||
|
||||
@@ -140,6 +141,8 @@ impl App {
|
||||
Stroke::new(1.0, Color32::from_rgb(200, 200, 200));
|
||||
});
|
||||
|
||||
// Load previous app state (if any).
|
||||
// Note that you must enable the `persistence` feature for this to work.
|
||||
if let Some(storage) = cc.storage {
|
||||
return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
|
||||
}
|
||||
@@ -194,6 +197,8 @@ impl eframe::App for App {
|
||||
//});
|
||||
|
||||
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
||||
// The top panel is often a good place for a menu bar:
|
||||
|
||||
egui::containers::menu::Bar::new().ui(ui, |ui| {
|
||||
// NOTE: no File->Quit on web pages!
|
||||
ui.menu_button("Menu ⚙", |ui| {
|
||||
|
||||
Reference in New Issue
Block a user