Forbid creating a panel from within another panel
This commit is contained in:
parent
16a984b71f
commit
07a32793d6
1 changed files with 9 additions and 1 deletions
|
@ -281,6 +281,10 @@ impl Context {
|
|||
|
||||
/// Shrink `available_rect()`.
|
||||
pub(crate) fn allocate_left_panel(&self, panel_rect: Rect) {
|
||||
debug_assert!(
|
||||
panel_rect.min == self.available_rect().min,
|
||||
"Mismatching panels. You must not create a panel from within another panel."
|
||||
);
|
||||
let mut remainder = self.available_rect();
|
||||
remainder.min.x = panel_rect.max.x;
|
||||
*self.available_rect.lock() = Some(remainder);
|
||||
|
@ -289,6 +293,10 @@ impl Context {
|
|||
|
||||
/// Shrink `available_rect()`.
|
||||
pub(crate) fn allocate_top_panel(&self, panel_rect: Rect) {
|
||||
debug_assert!(
|
||||
panel_rect.min == self.available_rect().min,
|
||||
"Mismatching panels. You must not create a panel from within another panel."
|
||||
);
|
||||
let mut remainder = self.available_rect();
|
||||
remainder.min.y = panel_rect.max.y;
|
||||
*self.available_rect.lock() = Some(remainder);
|
||||
|
|
Loading…
Reference in a new issue