From 62de97da547657f5ee80a134c8af71b0c99024f5 Mon Sep 17 00:00:00 2001 From: Matt Irvine Date: Mon, 8 Jan 2018 12:40:04 -0500 Subject: [PATCH] Redraw tab background color when dragged (#442) --- .../browser/parts/editor/tabsTitleControl.ts | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts index c1fe826813..07cb0ebd51 100644 --- a/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts +++ b/src/vs/workbench/browser/parts/editor/tabsTitleControl.ts @@ -245,6 +245,17 @@ export class TabsTitleControl extends TitleControl { element.style.outlineColor = activeContrastBorderColor; element.style.outlineOffset = null; } + + // {{SQL CARBON EDIT}} -- Display the editor's tab color + if (isTab) { + const tabContainer = this.tabsContainer.children[index]; + if (tabContainer instanceof HTMLElement) { + let editor = this.context.getEditor(index); + if (editor) { + this.setEditorTabColor(editor, tabContainer, isActiveTab); + } + } + } } public allowDragging(element: HTMLElement): boolean { @@ -335,18 +346,7 @@ export class TabsTitleControl extends TitleControl { } // {{SQL CARBON EDIT}} -- Display the editor's tab color - let sqlEditor = editor as any; - if (sqlEditor.tabColor && this.themeService.getTheme().type !== HIGH_CONTRAST) { - tabContainer.style.borderTopColor = sqlEditor.tabColor; - tabContainer.style.borderTopWidth = isTabActive ? '2px' : '1px'; - let backgroundColor = Color.Format.CSS.parseHex(sqlEditor.tabColor); - if (backgroundColor) { - tabContainer.style.backgroundColor = backgroundColor.transparent(isTabActive ? 0.3 : 0.2).toString(); - } - } else { - tabContainer.style.borderTopColor = ''; - tabContainer.style.borderTopWidth = ''; - } + this.setEditorTabColor(editor, tabContainer, isTabActive); } }); @@ -862,6 +862,22 @@ export class TabsTitleControl extends TitleControl { return !isCopy || source.id === target.id; } + + // {{SQL CARBON EDIT}} -- Display the editor's tab color + private setEditorTabColor(editor: IEditorInput, tabContainer: HTMLElement, isTabActive: boolean) { + let sqlEditor = editor as any; + if (sqlEditor.tabColor && this.themeService.getTheme().type !== HIGH_CONTRAST) { + tabContainer.style.borderTopColor = sqlEditor.tabColor; + tabContainer.style.borderTopWidth = isTabActive ? '2px' : '1px'; + let backgroundColor = Color.Format.CSS.parseHex(sqlEditor.tabColor); + if (backgroundColor) { + tabContainer.style.backgroundColor = backgroundColor.transparent(isTabActive ? 0.3 : 0.2).toString(); + } + } else { + tabContainer.style.borderTopColor = ''; + tabContainer.style.borderTopWidth = ''; + } + } } class TabActionRunner extends ActionRunner {