Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Dec 19, 2024
1 parent 020228c commit 9c22a09
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions crates/ui/src/dock/stack_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,38 @@ impl StackPanel {
self.panel_group.update(cx, |view, cx| {
view.set_child_visible(ix, visible, cx);
});
} else {
// Panel not found, try to find in children.
if let Some(parent) = self.parent.clone() {
cx.window_context().defer({
let parent = parent.clone();
let panel = panel.clone();
move |cx| {
_ = parent.update(cx, |parent, cx| {
parent.set_panel_visible(&panel, visible, cx);
});
}
});
}

// iter all children to find the panel.
cx.window_context().defer({
let panel = panel.clone();
let panels = self.panels.clone();
move |cx| {
for child in panels {
if let Ok(stack_panel) = child.view().downcast::<Self>() {
stack_panel.update(cx, |stack_panel, cx| {
stack_panel.set_panel_visible(&panel, visible, cx);
});
} else if let Ok(tab_panel) = child.view().downcast::<TabPanel>() {

Check failure on line 283 in crates/ui/src/dock/stack_panel.rs

View workflow job for this annotation

GitHub Actions / Test

unused variable: `tab_panel`
// tab_panel.update(cx, |tab_panel, cx| {
// tab_panel.set_panel_visible(&panel, visible, cx);
// });
}
}
}
})
}
}

Expand Down

0 comments on commit 9c22a09

Please sign in to comment.