提交 5129f3bc 编写于 作者: B Benjamin Pasero

keep active tab visible when resizing

上级 b86b2cbb
......@@ -1278,10 +1278,15 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
}
});
// Layout active editors
// Layout visible editors
POSITIONS.forEach(position => {
this.layoutEditor(position);
});
// Layout title controls
POSITIONS.forEach(position => {
this.titleAreaControl[position].layout();
});
}
private layoutEditor(position: Position): void {
......
......@@ -30,6 +30,7 @@ import {TitleControl} from 'vs/workbench/browser/parts/editor/titleControl';
export class TabsTitleControl extends TitleControl {
private titleContainer: Builder;
private tabsContainer: Builder;
private activeTab: Builder;
private groupActionsToolbar: ToolBar;
private tabActionBars: ActionBar[];
......@@ -140,8 +141,6 @@ export class TabsTitleControl extends TitleControl {
this.tabActionBars.pop().dispose();
}
let activeTab: HTMLElement;
// Add a tab for each opened editor
this.context.getEditors().forEach(editor => {
const isPinned = group.isPinned(editor);
......@@ -163,7 +162,7 @@ export class TabsTitleControl extends TitleControl {
// Active state
if (isActive) {
tab.addClass('active');
activeTab = tab.getHTMLElement();
this.activeTab = $(tab);
} else {
tab.removeClass('active');
}
......@@ -194,7 +193,16 @@ export class TabsTitleControl extends TitleControl {
});
});
this.layout();
}
public layout(): void {
if (!this.activeTab) {
return;
}
// Always reveal the active one
const activeTab = this.activeTab.getHTMLElement();
const container = this.tabsContainer.getHTMLElement();
const containerWidth = container.offsetWidth;
const containerScrollPosX = container.scrollLeft;
......
......@@ -43,6 +43,7 @@ export interface ITitleAreaControl {
allowDragging(element: HTMLElement): boolean;
create(parent: Builder): void;
refresh(): void;
layout(): void;
dispose(): void;
}
......@@ -95,6 +96,10 @@ export abstract class TitleControl {
public abstract refresh();
public layout(): void {
// Subclasses can opt in to react on layout
}
public allowDragging(element: HTMLElement): boolean {
return !DOM.findParentWithClass(element, 'monaco-action-bar', 'one-editor-container');
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册