workspace: Add setting to make dock resize apply to all panels (#30551)
Re: #19015 Close #12667 When dragging a dock’s resize handle, only the active panel grows or shrinks. This patch introduces an opt-in behaviour that lets users resize every panel hosted by that dock at once. Release Notes: - Added new `resize_all_panels_in_dock` setting to optionally resize every panel in a dock together. Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
ff6ac60bad
commit
8c1b549683
4 changed files with 46 additions and 3 deletions
|
@ -686,6 +686,19 @@ impl Dock {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn resize_all_panels(
|
||||
&mut self,
|
||||
size: Option<Pixels>,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
for entry in &mut self.panel_entries {
|
||||
let size = size.map(|size| size.max(RESIZE_HANDLE_SIZE).round());
|
||||
entry.panel.set_size(size, window, cx);
|
||||
}
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn toggle_action(&self) -> Box<dyn Action> {
|
||||
match self.position {
|
||||
DockPosition::Left => crate::ToggleLeftDock.boxed_clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue