提交 916287fd 编写于 作者: J Joao Moreno

remove EditorPart._preferredSize

related to #67367
上级 5cc02113
......@@ -112,13 +112,8 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
private _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; } | undefined>());
get onDidSizeConstraintsChange(): Event<{ width: number; height: number; } | undefined> { return Event.any(this.onDidSetGridWidget.event, this._onDidSizeConstraintsChange.event); }
private readonly _onDidPreferredSizeChange: Emitter<void> = this._register(new Emitter<void>());
readonly onDidPreferredSizeChange: Event<void> = this._onDidPreferredSizeChange.event;
//#endregion
private _preferredSize: Dimension | undefined;
private readonly workspaceMemento: MementoObject;
private readonly globalMemento: MementoObject;
......@@ -366,9 +361,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
const newOrientation = (orientation === GroupOrientation.HORIZONTAL) ? Orientation.HORIZONTAL : Orientation.VERTICAL;
if (this.gridWidget.orientation !== newOrientation) {
this.gridWidget.orientation = newOrientation;
// Mark preferred size as changed
this.resetPreferredSize();
}
}
......@@ -423,9 +415,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
// Update container
this.updateContainer();
// Mark preferred size as changed
this.resetPreferredSize();
// Events for groups that got added
this.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(groupView => {
if (currentGroupViews.indexOf(groupView) === -1) {
......@@ -490,9 +479,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
// Update container
this.updateContainer();
// Mark preferred size as changed
this.resetPreferredSize();
// Event
this._onDidAddGroup.fire(newGroupView);
......@@ -661,9 +647,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
// Update container
this.updateContainer();
// Mark preferred size as changed
this.resetPreferredSize();
// Event
this._onDidRemoveGroup.fire(groupView);
}
......@@ -764,23 +747,6 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
get onDidChange(): Event<IViewSize | undefined> { return this.centeredLayoutWidget.onDidChange; }
readonly priority: LayoutPriority = LayoutPriority.High;
get preferredSize(): Dimension {
if (!this._preferredSize) {
this._preferredSize = new Dimension(this.gridWidget.minimumWidth, this.gridWidget.minimumHeight);
}
return this._preferredSize;
}
private resetPreferredSize(): void {
// Reset (will be computed upon next access)
this._preferredSize = undefined;
// Event
this._onDidPreferredSizeChange.fire();
}
private get gridSeparatorBorder(): Color {
return this.theme.getColor(EDITOR_GROUP_BORDER) || this.theme.getColor(contrastBorder) || Color.transparent;
}
......
......@@ -118,11 +118,6 @@ suite('EditorGroupsService', () => {
groupMovedCounter++;
});
let preferredSizeChangeCounter = 0;
const preferredSizeChangeListener = part.onDidPreferredSizeChange(() => {
preferredSizeChangeCounter++;
});
// always a root group
const rootGroup = part.groups[0];
assert.equal(part.groups.length, 1);
......@@ -141,7 +136,6 @@ suite('EditorGroupsService', () => {
assert.equal(part.groups.length, 2);
assert.equal(part.count, 2);
assert.ok(part.activeGroup === rootGroup);
assert.equal(preferredSizeChangeCounter, 1);
assert.equal(rootGroup.label, 'Group 1');
assert.equal(rightGroup.label, 'Group 2');
......@@ -189,7 +183,6 @@ suite('EditorGroupsService', () => {
assert.equal(part.groups.length, 3);
assert.ok(part.activeGroup === rightGroup);
assert.ok(!downGroup.activeControl);
assert.equal(preferredSizeChangeCounter, 2);
assert.equal(rootGroup.label, 'Group 1');
assert.equal(rightGroup.label, 'Group 2');
assert.equal(downGroup.label, 'Group 3');
......@@ -208,13 +201,11 @@ suite('EditorGroupsService', () => {
part.moveGroup(downGroup, rightGroup, GroupDirection.DOWN);
assert.equal(groupMovedCounter, 1);
assert.equal(preferredSizeChangeCounter, 2);
part.removeGroup(downGroup);
assert.ok(!part.getGroup(downGroup.id));
assert.equal(didDispose, true);
assert.equal(groupRemovedCounter, 1);
assert.equal(preferredSizeChangeCounter, 3);
assert.equal(part.groups.length, 2);
assert.ok(part.activeGroup === rightGroup);
assert.equal(rootGroup.label, 'Group 1');
......@@ -254,13 +245,11 @@ suite('EditorGroupsService', () => {
assert.ok(part.activeGroup === rootGroup);
part.setGroupOrientation(part.orientation === GroupOrientation.HORIZONTAL ? GroupOrientation.VERTICAL : GroupOrientation.HORIZONTAL);
assert.equal(preferredSizeChangeCounter, 5);
activeGroupChangeListener.dispose();
groupAddedListener.dispose();
groupRemovedListener.dispose();
groupMovedListener.dispose();
preferredSizeChangeListener.dispose();
part.dispose();
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册