mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 12:50:04 -04:00
Add eframe::storage_dir (#3286)
* Add `eframe::storage_dir` Now you can easily tell where eframe stores its state * egui_plot: work even without the `serde` featur flag
This commit is contained in:
@@ -126,6 +126,7 @@ struct PlotMemory {
|
||||
last_click_pos_for_zoom: Option<Pos2>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
impl PlotMemory {
|
||||
pub fn load(ctx: &Context, id: Id) -> Option<Self> {
|
||||
ctx.data_mut(|d| d.get_persisted(id))
|
||||
@@ -136,6 +137,17 @@ impl PlotMemory {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "serde"))]
|
||||
impl PlotMemory {
|
||||
pub fn load(ctx: &Context, id: Id) -> Option<Self> {
|
||||
ctx.data_mut(|d| d.get_temp(id))
|
||||
}
|
||||
|
||||
pub fn store(self, ctx: &Context, id: Id) {
|
||||
ctx.data_mut(|d| d.insert_temp(id, self));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Indicates a vertical or horizontal cursor line in plot coordinates.
|
||||
|
||||
Reference in New Issue
Block a user