Skip to content

Commit

Permalink
Fix bug in Context::parent_viewport_id (#4190)
Browse files Browse the repository at this point in the history
* Closes #4084 

Fix : Display parent viewport id Issues
  • Loading branch information
rustbasic authored Mar 20, 2024
1 parent d449cb1 commit 1b34289
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,11 @@ impl ContextImpl {
///
/// For the root viewport this will return [`ViewportId::ROOT`].
pub(crate) fn parent_viewport_id(&self) -> ViewportId {
self.viewport_stack
.last()
.copied()
.unwrap_or_default()
.parent
let viewport_id = self.viewport_id();
*self
.viewport_parents
.get(&viewport_id)
.unwrap_or(&ViewportId::ROOT)
}

fn all_viewport_ids(&self) -> ViewportIdSet {
Expand Down

0 comments on commit 1b34289

Please sign in to comment.