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:
Aaron Ruan 2025-06-05 01:40:35 +08:00 committed by GitHub
parent ff6ac60bad
commit 8c1b549683
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 3 deletions

View file

@ -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(),