Implement zooming for panes and docks

This commit is contained in:
Antonio Scandurra 2023-05-16 11:49:48 +02:00
parent c03e470fe6
commit adf361b374
5 changed files with 122 additions and 63 deletions

View file

@ -2,7 +2,8 @@ mod dragged_item_receiver;
use super::{ItemHandle, SplitDirection};
use crate::{
item::WeakItemHandle, toolbar::Toolbar, Item, NewFile, NewSearch, NewTerminal, Workspace,
item::WeakItemHandle, toolbar::Toolbar, Item, NewFile, NewSearch, NewTerminal, ToggleZoom,
Workspace,
};
use anyhow::{anyhow, Result};
use collections::{HashMap, HashSet, VecDeque};
@ -69,7 +70,6 @@ actions!(
SplitUp,
SplitRight,
SplitDown,
ToggleZoom,
]
);
@ -135,7 +135,6 @@ pub enum Event {
ChangeItemTitle,
Focus,
ZoomIn,
ZoomOut,
}
pub struct Pane {
@ -662,9 +661,8 @@ impl Pane {
}
pub fn toggle_zoom(&mut self, _: &ToggleZoom, cx: &mut ViewContext<Self>) {
if self.zoomed {
cx.emit(Event::ZoomOut);
} else {
cx.propagate_action();
if !self.zoomed {
cx.emit(Event::ZoomIn);
}
}