debugger: Align zoom behavior with other panels (#31901)
Release Notes: - Debugger Beta: `shift-escape` (`workspace::ToggleZoom`) now zooms the entire debug panel; `alt-shift-escape` (`debugger::ToggleExpandItem`) triggers the old behavior of zooming a specific item.
This commit is contained in:
parent
63c1033448
commit
6f97da3435
6 changed files with 69 additions and 21 deletions
|
@ -311,6 +311,7 @@ pub struct Pane {
|
|||
>,
|
||||
can_split_predicate:
|
||||
Option<Arc<dyn Fn(&mut Self, &dyn Any, &mut Window, &mut Context<Self>) -> bool>>,
|
||||
can_toggle_zoom: bool,
|
||||
should_display_tab_bar: Rc<dyn Fn(&Window, &mut Context<Pane>) -> bool>,
|
||||
render_tab_bar_buttons: Rc<
|
||||
dyn Fn(
|
||||
|
@ -450,6 +451,7 @@ impl Pane {
|
|||
can_drop_predicate,
|
||||
custom_drop_handle: None,
|
||||
can_split_predicate: None,
|
||||
can_toggle_zoom: true,
|
||||
should_display_tab_bar: Rc::new(|_, cx| TabBarSettings::get_global(cx).show),
|
||||
render_tab_bar_buttons: Rc::new(default_render_tab_bar_buttons),
|
||||
render_tab_bar: Rc::new(Self::render_tab_bar),
|
||||
|
@ -650,6 +652,11 @@ impl Pane {
|
|||
self.can_split_predicate = can_split_predicate;
|
||||
}
|
||||
|
||||
pub fn set_can_toggle_zoom(&mut self, can_toggle_zoom: bool, cx: &mut Context<Self>) {
|
||||
self.can_toggle_zoom = can_toggle_zoom;
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn set_close_pane_if_empty(&mut self, close_pane_if_empty: bool, cx: &mut Context<Self>) {
|
||||
self.close_pane_if_empty = close_pane_if_empty;
|
||||
cx.notify();
|
||||
|
@ -1104,7 +1111,9 @@ impl Pane {
|
|||
}
|
||||
|
||||
pub fn toggle_zoom(&mut self, _: &ToggleZoom, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if self.zoomed {
|
||||
if !self.can_toggle_zoom {
|
||||
cx.propagate();
|
||||
} else if self.zoomed {
|
||||
cx.emit(Event::ZoomOut);
|
||||
} else if !self.items.is_empty() {
|
||||
if !self.focus_handle.contains_focused(window, cx) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue