From e3d5633dbfe5707ccb48e7ea0d2542c0fb988c5f Mon Sep 17 00:00:00 2001 From: isidor Date: Tue, 19 Jan 2016 15:58:14 +0100 Subject: [PATCH] panel: show horizontal sash even when panel is hidden --- src/vs/workbench/browser/layout.ts | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 01047c1c7e6..505f1343ce2 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -189,11 +189,30 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal // Panel visible if (!isPanelHidden) { - // TODO@Isidor Automatically hide panel when a certain threshold is met + // Automatically hide panel when a certain threshold is met + if (newSashHeight + HIDE_PANEL_HEIGHT_THRESHOLD < this.computedStyles.panel.minHeight) { + let dragCompensation = DEFAULT_MIN_PANEL_PART_HEIGHT - HIDE_PANEL_HEIGHT_THRESHOLD; + this.partService.setPanelHidden(true); + startY = Math.min(this.sidebarHeight - this.computedStyles.statusbar.height, e.currentY + dragCompensation); + this.panelHeight = this.startPanelHeight; // when restoring panel, restore to the panel width we started from + } + + // Otherwise size the panel accordingly + else { + this.panelHeight = Math.max(this.computedStyles.panel.minHeight, newSashHeight); // Panel can not become smaller than MIN_PART_HEIGHT + doLayout = newSashHeight >= this.computedStyles.panel.minHeight; + } + } - this.panelHeight = Math.max(this.computedStyles.panel.minHeight, newSashHeight); // Panel can not become smaller than MIN_PART_HEIGHT - doLayout = newSashHeight >= this.computedStyles.panel.minHeight; + // Panel hidden + else { + if (startY - e.currentY >= this.computedStyles.panel.minHeight) { + this.startPanelHeight = 0; + this.panelHeight = this.computedStyles.panel.minHeight; + this.partService.setPanelHidden(false); + } } + if (doLayout) { this.layout(); } @@ -420,7 +439,6 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal // Sashes this.sashX.layout(); - isPanelHidden ? this.sashY.hide() : this.sashY.show(); this.sashY.layout(); // Propagate to Part Layouts @@ -464,7 +482,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal } public getHorizontalSashTop(sash: Sash): number { - return this.sidebarHeight - this.panelHeight; + return this.partService.isPanelHidden() ? this.sidebarHeight : this.sidebarHeight - this.panelHeight; } public getHorizontalSashLeft(sash: Sash): number { -- GitLab