提交 6eeb98dc 编写于 作者: B Benjamin Pasero

cleanup workbench layout method

上级 3387ad0a
......@@ -46,6 +46,11 @@ interface ComputedStyles {
statusbar: { height: number; };
}
export interface ILayoutOptions {
forceStyleReCompute?: boolean;
toggleMaximizedPanel?: boolean;
}
/**
* The workbench layout is responsible to lay out all parts that make the Workbench.
*/
......@@ -297,8 +302,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
};
}
public layout(forceStyleReCompute?: boolean, toggleMaximizedPanel?: boolean): void {
if (forceStyleReCompute) {
public layout(options?: ILayoutOptions): void {
if (options && options.forceStyleReCompute) {
this.computeStyle();
this.editor.getLayout().computeStyle();
this.sidebar.getLayout().computeStyle();
......@@ -346,7 +351,7 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
} else {
panelHeight = sidebarSize.height * 0.4;
}
if (toggleMaximizedPanel) {
if (options && options.toggleMaximizedPanel) {
panelHeight = panelHeight === maxPanelHeight ? sidebarSize.height * 0.4 : maxPanelHeight;
}
const panelDimension = new Dimension(this.workbenchSize.width - sidebarSize.width - activityBarSize.width, panelHeight);
......
......@@ -524,7 +524,7 @@ export class Workbench implements IPartService {
// Layout
if (!skipLayout) {
this.workbenchLayout.layout(true);
this.workbenchLayout.layout({ forceStyleReCompute: true });
}
}
......@@ -544,7 +544,7 @@ export class Workbench implements IPartService {
// Layout
if (!skipLayout) {
this.workbenchLayout.layout(true);
this.workbenchLayout.layout({ forceStyleReCompute: true });
}
// If sidebar becomes hidden, also hide the current active Viewlet if any
......@@ -587,7 +587,7 @@ export class Workbench implements IPartService {
// Layout
if (!skipLayout) {
this.workbenchLayout.layout(true);
this.workbenchLayout.layout({ forceStyleReCompute: true });
}
// If panel part becomes hidden, also hide the current active panel if any
......@@ -615,7 +615,7 @@ export class Workbench implements IPartService {
}
public toggleMaximizedPanel(): void {
this.workbenchLayout.layout(true, true);
this.workbenchLayout.layout({ forceStyleReCompute: true, toggleMaximizedPanel: true });
}
public getSideBarPosition(): Position {
......@@ -638,7 +638,7 @@ export class Workbench implements IPartService {
this.sidebarPart.getContainer().addClass(newPositionValue);
// Layout
this.workbenchLayout.layout(true);
this.workbenchLayout.layout({ forceStyleReCompute: true });
}
public dispose(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册