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

Animate foldable regions

This commit is contained in:
Emil Ernerfeldt
2020-04-21 14:47:17 +02:00
parent 0ed578341b
commit 9be5537418
2 changed files with 59 additions and 12 deletions

View File

@@ -1,14 +1,30 @@
use std::collections::{HashMap, HashSet};
use std::collections::HashMap;
use crate::{window::WindowState, *};
// TODO: move together with foldable code into own file
#[derive(Clone, Copy, Debug)]
pub struct FoldableState {
pub open: bool,
pub toggle_time: f64,
}
impl Default for FoldableState {
fn default() -> Self {
Self {
open: false,
toggle_time: -std::f64::INFINITY,
}
}
}
#[derive(Clone, Debug, Default)]
pub struct Memory {
/// The widget being interacted with (e.g. dragged, in case of a slider).
pub(crate) active_id: Option<Id>,
/// Which foldable regions are open.
pub(crate) open_foldables: HashSet<Id>,
pub(crate) foldables: HashMap<Id, FoldableState>,
windows: HashMap<Id, WindowState>,