提交 d220b5a1 编写于 作者: B Benjamin Pasero

💄

上级 48ee232f
......@@ -540,15 +540,14 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
}
// change part size along the main axis
public resizePart(part: Parts, sizeChange: number): boolean {
let promise = TPromise.as(null);
let doLayout = false;
let newSashSize: number = 0;
let visibleEditors = this.editorService.getVisibleEditors().length;
public resizePart(part: Parts, sizeChange: number): void {
const visibleEditors = this.editorService.getVisibleEditors().length;
const sizeChangePxWidth = this.workbenchSize.width * (sizeChange / 100);
const sizeChangePxHeight = this.workbenchSize.height * (sizeChange / 100);
let doLayout = false;
let newSashSize: number = 0;
switch (part) {
case Parts.SIDEBAR_PART:
newSashSize = this.sidebarWidth + sizeChangePxWidth;
......@@ -572,10 +571,9 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
if (visibleEditorCount === 1) {
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
doLayout = true;
}
else {
const eGsSM = this.editorGroupService.getStacksModel();
const activeGroup = eGsSM.positionOfGroup(eGsSM.activeGroup);
} else {
const stacks = this.editorGroupService.getStacksModel();
const activeGroup = stacks.positionOfGroup(stacks.activeGroup);
this.editorGroupService.resizeGroup(activeGroup, sizeChangePxWidth);
doLayout = false;
......@@ -583,11 +581,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
}
if (doLayout) {
promise.done(() => this.layout(), errors.onUnexpectedError);
this.layout();
}
// other parts not resizable, no error just silent
return false;
}
public dispose(): void {
......
......@@ -78,7 +78,7 @@ export interface IEditorGroupsControl {
setGroupOrientation(orientation: GroupOrientation): void;
getGroupOrientation(): GroupOrientation;
resizeGroup(position: Position, groupSizeChange: number): boolean;
resizeGroup(position: Position, groupSizeChange: number): void;
getRatio(): number[];
......@@ -847,7 +847,7 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
}
// Resize the editor/group position - changes main axis
public resizeGroup(position: Position, groupSizeChange: number): boolean {
public resizeGroup(position: Position, groupSizeChange: number): void {
enum VISIBLE_EDITORS {
ONE = 1,
......@@ -858,10 +858,10 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
const visibleEditors = this.getVisibleEditorCount();
if (visibleEditors <= VISIBLE_EDITORS.ONE) {
return false;
return;
}
let availableSize = this.totalSize;
const availableSize = this.totalSize;
const activeGroupPosition = this.getActivePosition();
switch (visibleEditors) {
......@@ -898,9 +898,8 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
default:
break;
}
this.layout(this.dimension);
return true;
this.layout(this.dimension);
}
private boundSiloSize(siloPosition: Position, sizeChangePx: number): number {
......
......@@ -245,9 +245,8 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
this._onTabOptionsChanged.fire(this.tabOptions);
}
public resizeGroup(position: Position, groupSizeChange: number): boolean {
public resizeGroup(position: Position, groupSizeChange: number): void {
this.editorGroupsControl.resizeGroup(position, groupSizeChange);
return true;
}
public get onEditorsChanged(): Event<void> {
......
......@@ -1215,21 +1215,22 @@ export abstract class BaseResizeViewAction extends Action {
}
protected resizePart(sizeChange: number): void {
const isEditorFocus = this.partService.hasFocus(Parts.EDITOR_PART);
const isSidebarFocus = this.partService.hasFocus(Parts.SIDEBAR_PART);
const isPanelFocus = this.partService.hasFocus(Parts.PANEL_PART);
let part: Parts;
if (isSidebarFocus) {
this.partService.resizePart(Parts.SIDEBAR_PART, sizeChange);
}
else if (isPanelFocus) {
this.partService.resizePart(Parts.PANEL_PART, sizeChange);
part = Parts.SIDEBAR_PART;
} else if (isPanelFocus) {
part = Parts.PANEL_PART;
} else if (isEditorFocus) {
part = Parts.EDITOR_PART;
}
else if (isEditorFocus) {
this.partService.resizePart(Parts.EDITOR_PART, sizeChange);
if (part) {
this.partService.resizePart(part, sizeChange);
}
return;
}
}
......
......@@ -1149,18 +1149,15 @@ export class Workbench implements IPartService {
// Resize requested part along the main axis
// layout will do all the math for us and adjusts the other Parts
public resizePart(part: Parts, sizeChange: number): void {
switch (part) {
case Parts.SIDEBAR_PART:
case Parts.PANEL_PART:
case Parts.EDITOR_PART:
this.workbenchLayout.resizePart(part, sizeChange);
break;
// Cannot resize other parts
default:
return;
return; // Cannot resize other parts
}
return;
}
......
......@@ -98,10 +98,10 @@ export interface IEditorGroupService {
*/
getGroupOrientation(): GroupOrientation;
/*
Resize visible editor groups
*/
resizeGroup(position: Position, groupSizeChange: number): boolean;
/**
* Resize visible editor groups
*/
resizeGroup(position: Position, groupSizeChange: number): void;
/**
* Adds the pinned state to an editor, removing it from being a preview editor.
......@@ -131,5 +131,4 @@ export interface IEditorGroupService {
* Returns tab options.
*/
getTabOptions(): ITabOptions;
}
\ No newline at end of file
......@@ -121,5 +121,4 @@ export interface IPartService {
* Resizes currently focused part on main access
*/
resizePart(part: Parts, sizeChange: number): void;
}
\ No newline at end of file
......@@ -459,8 +459,8 @@ export class TestEditorGroupService implements IEditorGroupService {
return 'vertical';
}
public resizeGroup(position: Position, groupSizeChange: number): boolean {
return true;
public resizeGroup(position: Position, groupSizeChange: number): void {
}
public pinEditor(group: IEditorGroup, input: IEditorInput): void;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册