提交 3ceb3a10 编写于 作者: B Benjamin Pasero

tabs - improve logic of previously used dimensions and relayout

上级 6bd7b705
...@@ -1322,7 +1322,10 @@ export class TabsTitleControl extends TitleControl { ...@@ -1322,7 +1322,10 @@ export class TabsTitleControl extends TitleControl {
}); });
} }
return new Dimension(dimensions.container.width, this.getDimensions().height); // Compute new dimension of tabs title control and remember it for future usages
this.dimensions.used = new Dimension(dimensions.container.width, this.getDimensions().height);
return this.dimensions.used;
} }
private doLayout(dimensions: ITitleControlDimensions): void { private doLayout(dimensions: ITitleControlDimensions): void {
...@@ -1339,18 +1342,13 @@ export class TabsTitleControl extends TitleControl { ...@@ -1339,18 +1342,13 @@ export class TabsTitleControl extends TitleControl {
this.doLayoutTabs(activeTab, activeIndex, dimensions); this.doLayoutTabs(activeTab, activeIndex, dimensions);
} }
// Compute new dimension of tabs title control and remember it for future usages
const oldDimension = this.dimensions.used;
const newDimension = this.dimensions.used = new Dimension(dimensions.container.width, this.getDimensions().height);
// In case the height of the title control changed from before // In case the height of the title control changed from before
// (currently only possible if tabs are set to wrap), we need // (currently only possible if wrapping changed on/off), we need
// to signal this to the outside via a `relayout` call so that // to signal this to the outside via a `relayout` call so that
// e.g. the editor control can be adjusted accordingly. // e.g. the editor control can be adjusted accordingly.
if ( const oldDimension = this.dimensions.used;
this.accessor.partOptions.wrapTabs && const newDimension = new Dimension(dimensions.container.width, this.getDimensions().height);
oldDimension && oldDimension.height !== newDimension.height if (oldDimension && oldDimension.height !== newDimension.height) {
) {
this.group.relayout(); this.group.relayout();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册