Prevent empty panes from being zoomed (#2520)

Closes
https://linear.app/zed-industries/issue/Z-1789/empty-panes-should-not-be-zoomable
This commit is contained in:
Antonio Scandurra 2023-05-24 10:51:52 +02:00 committed by GitHub
commit 9575ffc1e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -683,7 +683,7 @@ impl Pane {
pub fn toggle_zoom(&mut self, _: &ToggleZoom, cx: &mut ViewContext<Self>) {
if self.zoomed {
cx.emit(Event::ZoomOut);
} else {
} else if !self.items.is_empty() {
cx.emit(Event::ZoomIn);
}
}
@ -983,6 +983,10 @@ impl Pane {
.remove(&item.id());
}
if self.items.is_empty() && self.zoomed {
cx.emit(Event::ZoomOut);
}
cx.notify();
}