get toolbar width only once

fixes #39185
This commit is contained in:
isidor
2017-12-01 16:05:32 +01:00
parent 8f69bfe9af
commit 0287d832ff
@@ -31,6 +31,7 @@ import { ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/composit
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IBadge } from 'vs/workbench/services/activity/common/activity';
import { memoize } from 'vs/base/common/decorators';
export class PanelPart extends CompositePart<Panel> implements IPanelService {
@@ -234,12 +235,17 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
let availableWidth = this.dimension.width - 8; // take padding into account
if (this.toolBar) {
// adjust height for global actions showing
availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.toolBar.getContainer().getHTMLElement().offsetWidth);
availableWidth = Math.max(PanelPart.MIN_COMPOSITE_BAR_WIDTH, availableWidth - this.toolbarWidth);
}
this.compositeBar.layout(new Dimension(availableWidth, this.dimension.height));
}
}
@memoize
private get toolbarWidth(): number {
return this.toolBar.getContainer().getHTMLElement().offsetWidth;
}
public shutdown(): void {
// Persist Hidden State
this.compositeBar.store();