提交 6186155c 编写于 作者: I isidor

CompositeBar: relayout on panel open since different panels have different action bar width

上级 f53f4d9f
......@@ -41,6 +41,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
private blockOpeningPanel: boolean;
private compositeBar: CompositeBar;
private dimension: Dimension;
constructor(
id: string,
......@@ -100,7 +101,11 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
private registerListeners(): void {
// Activate panel action on opening of a panel
this.toUnbind.push(this.onDidPanelOpen(panel => this.compositeBar.activateComposite(panel.getId())));
this.toUnbind.push(this.onDidPanelOpen(panel => {
this.compositeBar.activateComposite(panel.getId());
// Need to relayout composite bar since different panels have different action bar width
this.layoutCompositeBar();
}));
// Deactivate panel action on close
this.toUnbind.push(this.onDidPanelClose(panel => this.compositeBar.deactivateComposite(panel.getId())));
......@@ -208,14 +213,19 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
// Pass to super
const sizes = super.layout(dimension);
let availableWidth = dimension.width - 8; // take padding into account
this.dimension = dimension;
this.layoutCompositeBar();
return sizes;
}
private layoutCompositeBar(): void {
let availableWidth = this.dimension.width - 8; // take padding into account
if (this.toolBar) {
// adjust height for global actions showing
availableWidth -= this.toolBar.getContainer().getHTMLElement().offsetWidth;
}
this.compositeBar.layout(new Dimension(availableWidth, dimension.height));
return sizes;
this.compositeBar.layout(new Dimension(availableWidth, this.dimension.height));
}
public shutdown(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册