提交 f7349ba5 编写于 作者: C cleidigh

Fix logic for 1 editor Inc/Dec View command

上级 8dfa696a
......@@ -700,7 +700,10 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
// change part size along the main axis
public resizePart(part: Parts, sizeChange: number): void {
const visibleEditors = this.editorService.getVisibleEditors().length;
const visibleEditorCount = this.editorService.getVisibleEditors().length;
const isSidebarVisible = this.partService.isVisible(Parts.SIDEBAR_PART);
const isPanelVisible = this.partService.isVisible(Parts.PANEL_PART);
const panelPosition = this.partService.getPanelPosition();
const sizeChangePxWidth = this.workbenchSize.width * (sizeChange / 100);
const sizeChangePxHeight = this.workbenchSize.height * (sizeChange / 100);
......@@ -710,24 +713,37 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
case Parts.SIDEBAR_PART:
this.sidebarWidth = this.sidebarWidth + sizeChangePxWidth; // Sidebar can not become smaller than MIN_PART_WIDTH
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < visibleEditors * MIN_EDITOR_PART_WIDTH)) {
this.sidebarWidth = (this.workbenchSize.width - visibleEditors * MIN_EDITOR_PART_WIDTH);
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < visibleEditorCount * MIN_EDITOR_PART_WIDTH)) {
this.sidebarWidth = (this.workbenchSize.width - visibleEditorCount * MIN_EDITOR_PART_WIDTH);
}
doLayout = true;
break;
case Parts.PANEL_PART:
this.panelHeight = this.panelHeight + sizeChangePxHeight;
this.panelWidth = this.panelWidth + sizeChangePxWidth;
if (panelPosition === Position.BOTTOM) {
this.panelHeight = this.panelHeight + sizeChangePxHeight;
} else if (panelPosition === Position.RIGHT) {
this.panelWidth = this.panelWidth + sizeChangePxWidth;
}
doLayout = true;
break;
case Parts.EDITOR_PART:
// If we have one editor we can cheat and resize sidebar with the negative delta
const visibleEditorCount = this.editorService.getVisibleEditors().length;
// If the sidebar is not visible and panel is, resize panel main axis with negative Delta
if (visibleEditorCount === 1) {
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
doLayout = true;
if (isSidebarVisible) {
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
doLayout = true;
} else if (isPanelVisible) {
if (panelPosition === Position.BOTTOM) {
this.panelHeight = this.panelHeight - sizeChangePxHeight;
} else if (panelPosition === Position.RIGHT) {
this.panelWidth = this.panelWidth - sizeChangePxWidth;
}
doLayout = true;
}
} else {
const stacks = this.editorGroupService.getStacksModel();
const activeGroup = stacks.positionOfGroup(stacks.activeGroup);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册