Expose area::State's Rect in Memory (#3161)
This commit is contained in:
parent
f0addc339c
commit
2c7c59820e
|
|
@ -55,6 +55,8 @@ impl State {
|
|||
/// });
|
||||
/// # });
|
||||
/// ```
|
||||
///
|
||||
/// The previous rectangle used by this area can be obtained through [`crate::Memory::area_rect()`].
|
||||
#[must_use = "You should call .show()"]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Area {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ use super::*;
|
|||
/// ui.label("Hello World!");
|
||||
/// });
|
||||
/// # });
|
||||
/// ```
|
||||
///
|
||||
/// The previous rectangle used by this window can be obtained through [`crate::Memory::area_rect()`].
|
||||
#[must_use = "You should call .show()"]
|
||||
pub struct Window<'open> {
|
||||
title: WidgetText,
|
||||
|
|
|
|||
|
|
@ -487,6 +487,11 @@ impl Memory {
|
|||
pub fn reset_areas(&mut self) {
|
||||
self.areas = Default::default();
|
||||
}
|
||||
|
||||
/// Obtain the previous rectangle of an area.
|
||||
pub fn area_rect(&self, id: impl Into<Id>) -> Option<Rect> {
|
||||
self.areas.get(id.into()).map(|state| state.rect())
|
||||
}
|
||||
}
|
||||
|
||||
/// ## Popups
|
||||
|
|
|
|||
Loading…
Reference in New Issue