dock: Fix toggle dock button display when have nested panels. (#309)
This commit is contained in:
parent
185eca6c67
commit
cf88a48bec
3 changed files with 9 additions and 5 deletions
|
|
@ -65,7 +65,7 @@ impl StoryWorkspace {
|
|||
vec![Arc::new(StoryContainer::panel::<ListStory>(cx))];
|
||||
|
||||
let bottom_panels: Vec<Arc<dyn PanelView>> = vec![
|
||||
Arc::new(StoryContainer::panel::<TextStory>(cx)),
|
||||
Arc::new(StoryContainer::panel::<TooltipStory>(cx)),
|
||||
Arc::new(StoryContainer::panel::<IconStory>(cx)),
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@ impl super::Story for IconStory {
|
|||
"Icon"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Icon use examples"
|
||||
}
|
||||
|
||||
fn new_view(cx: &mut WindowContext) -> View<impl gpui::FocusableView> {
|
||||
Self::view(cx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,6 +282,10 @@ impl StackPanel {
|
|||
pub(super) fn is_top_left_panel(&self, panel: View<TabPanel>, cx: &AppContext) -> bool {
|
||||
let first_panel = self.panels.first();
|
||||
|
||||
if let Some(parent) = &self.parent {
|
||||
return parent.read(cx).is_top_left_panel(panel, cx);
|
||||
}
|
||||
|
||||
if let Some(view) = first_panel {
|
||||
if let Ok(view) = view.view().downcast::<TabPanel>() {
|
||||
return view.entity_id() == panel.entity_id();
|
||||
|
|
@ -300,6 +304,10 @@ impl StackPanel {
|
|||
self.panels.last()
|
||||
};
|
||||
|
||||
if let Some(parent) = &self.parent {
|
||||
return parent.read(cx).is_top_right_panel(panel, cx);
|
||||
}
|
||||
|
||||
if let Some(view) = first_panel {
|
||||
if let Ok(view) = view.view().downcast::<TabPanel>() {
|
||||
return view.entity_id() == panel.entity_id();
|
||||
|
|
|
|||
Loading…
Reference in a new issue