diff --git a/crates/story/examples/dock.rs b/crates/story/examples/dock.rs index ec4c222c..8500e2b7 100644 --- a/crates/story/examples/dock.rs +++ b/crates/story/examples/dock.rs @@ -2,7 +2,7 @@ use anyhow::{Context as _, Result}; use gpui::*; use gpui_component::{ button::{Button, ButtonVariants as _}, - dock::{DockArea, DockAreaState, DockEvent, DockItem, DockPlacement}, + dock::{ClosePanel, DockArea, DockAreaState, DockEvent, DockItem, DockPlacement, ToggleZoom}, popup_menu::PopupMenuExt, IconName, Root, Sizable, Theme, }; @@ -41,6 +41,11 @@ pub fn init(cx: &mut App) { gpui_component::init(cx); story::init(cx); + cx.bind_keys(vec![ + KeyBinding::new("shift-escape", ToggleZoom, None), + KeyBinding::new("ctrl-w", ClosePanel, None), + ]); + cx.activate(true); } diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index 6182ccd9..13769093 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -444,7 +444,7 @@ impl TabPanel { .icon(icon) .xsmall() .ghost() - .tooltip(tooltip) + .tooltip_with_action(tooltip, &ToggleZoom, None) .when(zoomed, |this| this.selected(true)) .on_click(cx.listener(|view, _, window, cx| { view.on_action_toggle_zoom(&ToggleZoom, window, cx) @@ -799,6 +799,7 @@ impl TabPanel { let is_render_in_tabs = self.panels.len() > 1 && self.inner_padding(cx); v_flex() + .id("active-panel") .group("") .flex_1() .when(is_render_in_tabs, |this| this.pt_2())