mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 02:20:10 +00:00
Make active panel's button close its dock
This commit is contained in:
parent
584e5f7958
commit
76927b6d95
1 changed files with 13 additions and 2 deletions
|
@ -472,11 +472,22 @@ impl View for PanelButtons {
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_children(panels.into_iter().enumerate().map(
|
.with_children(panels.into_iter().enumerate().map(
|
||||||
|(panel_ix, (view, context_menu))| {
|
|(panel_ix, (view, context_menu))| {
|
||||||
let (tooltip, tooltip_action) = view.icon_tooltip(cx);
|
let is_active = is_open && panel_ix == active_ix;
|
||||||
|
let (tooltip, tooltip_action) = if is_active {
|
||||||
|
(
|
||||||
|
format!("Close {} dock", dock_position.to_label()),
|
||||||
|
Some(match dock_position {
|
||||||
|
DockPosition::Left => crate::ToggleLeftDock.boxed_clone(),
|
||||||
|
DockPosition::Bottom => crate::ToggleBottomDock.boxed_clone(),
|
||||||
|
DockPosition::Right => crate::ToggleRightDock.boxed_clone(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
view.icon_tooltip(cx)
|
||||||
|
};
|
||||||
Stack::new()
|
Stack::new()
|
||||||
.with_child(
|
.with_child(
|
||||||
MouseEventHandler::<Self, _>::new(panel_ix, cx, |state, cx| {
|
MouseEventHandler::<Self, _>::new(panel_ix, cx, |state, cx| {
|
||||||
let is_active = is_open && panel_ix == active_ix;
|
|
||||||
let style = button_style.style_for(state, is_active);
|
let style = button_style.style_for(state, is_active);
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child(
|
.with_child(
|
||||||
|
|
Loading…
Reference in a new issue