Notify toolbars if active item changes independently of visibility

This commit is contained in:
Antonio Scandurra 2022-02-18 16:31:52 +01:00
parent 98bedbd4cf
commit 78ce479496

View file

@ -449,14 +449,11 @@ impl Pane {
} }
fn update_active_toolbar(&mut self, cx: &mut ViewContext<Self>) { fn update_active_toolbar(&mut self, cx: &mut ViewContext<Self>) {
if let Some(type_id) = self.active_toolbar_type { let active_item = self.item_views.get(self.active_item_index);
if let Some(toolbar) = self.toolbars.get(&type_id) { for (toolbar_type_id, toolbar) in &self.toolbars {
self.active_toolbar_visible = toolbar.active_item_changed( let visible = toolbar.active_item_changed(active_item.map(|i| i.1.clone()), cx);
self.item_views if Some(*toolbar_type_id) == self.active_toolbar_type {
.get(self.active_item_index) self.active_toolbar_visible = visible;
.map(|i| i.1.clone()),
cx,
);
} }
} }
} }