Skip to content

Commit

Permalink
Expose area::State in Memory
Browse files Browse the repository at this point in the history
  • Loading branch information
tosti007 committed Jul 14, 2023
1 parent 4ce0751 commit 548792a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/egui/src/containers/area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::*;
// TODO(emilk): this is not currently stored in `Memory::data`, but maybe it should be?
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub(crate) struct State {
pub struct State {
/// Last known pos of the pivot
pub pivot_pos: Pos2,

Expand Down
5 changes: 5 additions & 0 deletions crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,11 @@ impl Memory {
pub fn reset_areas(&mut self) {
self.areas = Default::default();
}

/// Obtain the state (positions, sizes ect) of a window.
pub fn area_state(&self, title: impl std::hash::Hash) -> Option<&area::State> {
self.areas.areas.get(&Id::new(title))
}
}

/// ## Popups
Expand Down

0 comments on commit 548792a

Please sign in to comment.