Skip to content

Commit 54c9ac5

Browse files
committed
better max panel width / height computation
fixes microsoft#37427
1 parent 4498b20 commit 54c9ac5

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

src/vs/workbench/browser/layout.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
163163
}
164164

165165
private set panelHeight(value: number) {
166-
const maxPanelHeight = this.sidebarHeight - this.editorCountForHeight * this.partLayoutInfo.editor.minHeight;
167-
this._panelHeight = Math.min(maxPanelHeight, Math.max(this.partLayoutInfo.panel.minHeight, value));
166+
this._panelHeight = Math.min(this.computeMaxPanelHeight(), Math.max(this.partLayoutInfo.panel.minHeight, value));
168167
}
169168

170169
private get panelWidth(): number {
@@ -177,9 +176,16 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
177176
}
178177

179178
private set panelWidth(value: number) {
180-
const sidebarVisible = this.partService.isVisible(Parts.SIDEBAR_PART) ? 1 : 0;
181-
const maxPanelWidth = this.workbenchSize.width - this.editorCountForWidth * this.partLayoutInfo.editor.minWidth - this.partLayoutInfo.sidebar.minWidth * sidebarVisible - this.activitybarWidth;
182-
this._panelWidth = Math.min(maxPanelWidth, Math.max(this.partLayoutInfo.panel.minWidth, value));
179+
this._panelWidth = Math.min(this.computeMaxPanelWidth(), Math.max(this.partLayoutInfo.panel.minWidth, value));
180+
}
181+
182+
private computeMaxPanelWidth(): number {
183+
const minSidebarSize = this.partService.isVisible(Parts.SIDEBAR_PART) ? (this.partService.getSideBarPosition() === Position.LEFT ? this.partLayoutInfo.sidebar.minWidth : this.sidebarWidth) : 0;
184+
return Math.max(this.partLayoutInfo.panel.minWidth, this.workbenchSize.width - this.editorCountForWidth * this.partLayoutInfo.editor.minWidth - minSidebarSize - this.activitybarWidth);
185+
}
186+
187+
private computeMaxPanelHeight(): number {
188+
return Math.max(this.partLayoutInfo.panel.minHeight, this.sidebarHeight - this.editorCountForHeight * this.partLayoutInfo.editor.minHeight);
183189
}
184190

185191
private get sidebarWidth(): number {
@@ -454,8 +460,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
454460
// Panel part
455461
let panelHeight: number;
456462
let panelWidth: number;
457-
const maxPanelHeight = Math.max(this.partLayoutInfo.panel.minHeight, sidebarSize.height - this.editorCountForHeight * this.partLayoutInfo.editor.minHeight);
458-
const maxPanelWidth = Math.max(this.partLayoutInfo.panel.minWidth, this.workbenchSize.width - activityBarSize.width - (isSidebarHidden ? 0 : this.partLayoutInfo.sidebar.minWidth) - this.editorCountForWidth * this.partLayoutInfo.editor.minWidth);
463+
const maxPanelHeight = this.computeMaxPanelHeight();
464+
const maxPanelWidth = this.computeMaxPanelWidth();
459465

460466
if (isPanelHidden) {
461467
panelHeight = 0;

0 commit comments

Comments
 (0)