Always focus a panel when zooming it

This allows us to zoom a panel when clicking a button, even if the
panel isn't currently focused.
This commit is contained in:
Nathan Sobo 2023-06-22 06:55:31 -06:00
parent a49189a704
commit 1707652643
2 changed files with 5 additions and 10 deletions

View file

@ -905,10 +905,11 @@ impl Workspace {
});
} else if T::should_zoom_in_on_event(event) {
dock.update(cx, |dock, cx| dock.set_panel_zoomed(&panel, true, cx));
if panel.has_focus(cx) {
this.zoomed = Some(panel.downgrade().into_any());
this.zoomed_position = Some(panel.read(cx).position(cx));
if !panel.has_focus(cx) {
cx.focus(&panel);
}
this.zoomed = Some(panel.downgrade().into_any());
this.zoomed_position = Some(panel.read(cx).position(cx));
} else if T::should_zoom_out_on_event(event) {
dock.update(cx, |dock, cx| dock.set_panel_zoomed(&panel, false, cx));
if this.zoomed_position == Some(prev_position) {