提交 febf978c 编写于 作者: J Joao Moreno

cache panel body size

fixes #60018
上级 d729e505
...@@ -46,7 +46,6 @@ export abstract class Panel implements IView { ...@@ -46,7 +46,6 @@ export abstract class Panel implements IView {
protected _expanded: boolean; protected _expanded: boolean;
protected disposables: IDisposable[] = []; protected disposables: IDisposable[] = [];
private expandedSize: number | undefined = undefined;
private _headerVisible = true; private _headerVisible = true;
private _minimumBodySize: number; private _minimumBodySize: number;
private _maximumBodySize: number; private _maximumBodySize: number;
...@@ -55,6 +54,9 @@ export abstract class Panel implements IView { ...@@ -55,6 +54,9 @@ export abstract class Panel implements IView {
private header: HTMLElement; private header: HTMLElement;
private cachedExpandedSize: number | undefined = undefined;
private cachedBodySize: number | undefined = undefined;
private _onDidChange = new Emitter<number | undefined>(); private _onDidChange = new Emitter<number | undefined>();
readonly onDidChange: Event<number | undefined> = this._onDidChange.event; readonly onDidChange: Event<number | undefined> = this._onDidChange.event;
...@@ -129,7 +131,7 @@ export abstract class Panel implements IView { ...@@ -129,7 +131,7 @@ export abstract class Panel implements IView {
this._expanded = !!expanded; this._expanded = !!expanded;
this.updateHeader(); this.updateHeader();
this._onDidChange.fire(expanded ? this.expandedSize : undefined); this._onDidChange.fire(expanded ? this.cachedExpandedSize : undefined);
} }
get headerVisible(): boolean { get headerVisible(): boolean {
...@@ -190,8 +192,14 @@ export abstract class Panel implements IView { ...@@ -190,8 +192,14 @@ export abstract class Panel implements IView {
const headerSize = this.headerVisible ? Panel.HEADER_SIZE : 0; const headerSize = this.headerVisible ? Panel.HEADER_SIZE : 0;
if (this.isExpanded()) { if (this.isExpanded()) {
this.layoutBody(size - headerSize); const bodySize = size - headerSize;
this.expandedSize = size;
if (bodySize !== this.cachedBodySize) {
this.layoutBody(bodySize);
this.cachedBodySize = bodySize;
}
this.cachedExpandedSize = size;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册