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 f8e04d7
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 Into<WidgetText>) -> Option<&area::State> {

Check failure on line 492 in crates/egui/src/memory.rs

View workflow job for this annotation

GitHub Actions / Check wasm32 + wasm-bindgen

cannot find type `WidgetText` in this scope

Check failure on line 492 in crates/egui/src/memory.rs

View workflow job for this annotation

GitHub Actions / Format + check + test

cannot find type `WidgetText` in this scope

Check failure on line 492 in crates/egui/src/memory.rs

View workflow job for this annotation

GitHub Actions / Check Windows

cannot find type `WidgetText` in this scope
self.areas.areas.get(&Id::new(title.into()))
}
}

/// ## Popups
Expand Down

0 comments on commit f8e04d7

Please sign in to comment.