dock: Show keybinding for ToggleZoom menu and button. (#861)
And binding `Shift-Esc` for example to toggle zoom panel, `Ctrl-W` for close panel. 
This commit is contained in:
parent
3c85ccbe2a
commit
1e2cc8315a
2 changed files with 8 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ use anyhow::{Context as _, Result};
|
||||||
use gpui::*;
|
use gpui::*;
|
||||||
use gpui_component::{
|
use gpui_component::{
|
||||||
button::{Button, ButtonVariants as _},
|
button::{Button, ButtonVariants as _},
|
||||||
dock::{DockArea, DockAreaState, DockEvent, DockItem, DockPlacement},
|
dock::{ClosePanel, DockArea, DockAreaState, DockEvent, DockItem, DockPlacement, ToggleZoom},
|
||||||
popup_menu::PopupMenuExt,
|
popup_menu::PopupMenuExt,
|
||||||
IconName, Root, Sizable, Theme,
|
IconName, Root, Sizable, Theme,
|
||||||
};
|
};
|
||||||
|
|
@ -41,6 +41,11 @@ pub fn init(cx: &mut App) {
|
||||||
gpui_component::init(cx);
|
gpui_component::init(cx);
|
||||||
story::init(cx);
|
story::init(cx);
|
||||||
|
|
||||||
|
cx.bind_keys(vec![
|
||||||
|
KeyBinding::new("shift-escape", ToggleZoom, None),
|
||||||
|
KeyBinding::new("ctrl-w", ClosePanel, None),
|
||||||
|
]);
|
||||||
|
|
||||||
cx.activate(true);
|
cx.activate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ impl TabPanel {
|
||||||
.icon(icon)
|
.icon(icon)
|
||||||
.xsmall()
|
.xsmall()
|
||||||
.ghost()
|
.ghost()
|
||||||
.tooltip(tooltip)
|
.tooltip_with_action(tooltip, &ToggleZoom, None)
|
||||||
.when(zoomed, |this| this.selected(true))
|
.when(zoomed, |this| this.selected(true))
|
||||||
.on_click(cx.listener(|view, _, window, cx| {
|
.on_click(cx.listener(|view, _, window, cx| {
|
||||||
view.on_action_toggle_zoom(&ToggleZoom, 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);
|
let is_render_in_tabs = self.panels.len() > 1 && self.inner_padding(cx);
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
|
.id("active-panel")
|
||||||
.group("")
|
.group("")
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.when(is_render_in_tabs, |this| this.pt_2())
|
.when(is_render_in_tabs, |this| this.pt_2())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue