From e28c26502525ce188b611529b69b7377d742aca1 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 19 Jun 2018 09:24:47 +0200 Subject: [PATCH] Revert "Revert "adding titlebar icon svg"" This reverts commit 74a101506f4b976ca05975630a10a0afbfb5966f. --- package.json | 2 +- .../browser/parts/titlebar/media/code-icon.svg | 1 + .../parts/titlebar/media/titlebarpart.css | 8 +++++--- .../browser/parts/titlebar/titlebarPart.ts | 17 ++++++++--------- 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 src/vs/workbench/browser/parts/titlebar/media/code-icon.svg diff --git a/package.json b/package.json index 35c5537d05b..add4abb2980 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.25.0", - "distro": "5f30bb6859641677a2676f623f994f923e609469", + "distro": "e781cd4cf9c4c77fa3c0fcb04017a3ba57cde7a2", "author": { "name": "Microsoft Corporation" }, diff --git a/src/vs/workbench/browser/parts/titlebar/media/code-icon.svg b/src/vs/workbench/browser/parts/titlebar/media/code-icon.svg new file mode 100644 index 00000000000..cc61f81ea5a --- /dev/null +++ b/src/vs/workbench/browser/parts/titlebar/media/code-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index fc61158b914..770803a9a34 100644 --- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -54,14 +54,16 @@ } .monaco-workbench > .part.titlebar > .window-appicon { - width: 15px; - padding-left: 10px; + width: 35px; margin-right: 113px; -webkit-app-region: no-drag; position: relative; z-index: 99; order: 1; - image-rendering: crisp-edges; + background-image: url('code-icon.svg'); + background-repeat: no-repeat; + background-position: center center; + background-size: 16px; } .monaco-workbench > .part.titlebar > .window-controls-container { diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 229ef8bfe91..a7dd3d25003 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -57,8 +57,8 @@ export class TitlebarPart extends Part implements ITitleService { titleFontSize?: number; titlebarHeight?: number; controlsWidth?: number; + appIconSize?: number; appIconWidth?: number; - appIconLeftPadding?: number; } = Object.create(null); private isInactive: boolean; @@ -251,9 +251,8 @@ export class TitlebarPart extends Part implements ITitleService { // App Icon (Windows/Linux) if (!isMacintosh) { - this.appIcon = $(this.titleContainer).img({ + this.appIcon = $(this.titleContainer).div({ class: 'window-appicon', - src: paths.join(this.environmentService.appRoot, isWindows ? 'resources/win32/code.ico' : 'resources/linux/code.png') }).on(EventType.DBLCLICK, e => { EventHelper.stop(e, true); @@ -457,14 +456,14 @@ export class TitlebarPart extends Part implements ITitleService { this.initialSizing.appIconWidth = parseInt(this.appIcon.getComputedStyle().width, 10); } - if (typeof this.initialSizing.appIconLeftPadding !== 'number') { - this.initialSizing.appIconLeftPadding = parseInt(this.appIcon.getComputedStyle().paddingLeft, 10); + if (typeof this.initialSizing.appIconSize !== 'number') { + this.initialSizing.appIconSize = parseInt(this.appIcon.getComputedStyle().backgroundSize, 10); } const currentAppIconHeight = parseInt(this.appIcon.getComputedStyle().height, 10); const newControlsWidth = this.initialSizing.controlsWidth / getZoomFactor(); const newAppIconWidth = this.initialSizing.appIconWidth / getZoomFactor(); - const newAppIconPaddingLeft = this.initialSizing.appIconLeftPadding / getZoomFactor(); + const newAppIconSize = this.initialSizing.appIconSize / getZoomFactor(); if (!this.menubarWidth) { this.menubarWidth = 0; @@ -483,9 +482,9 @@ export class TitlebarPart extends Part implements ITitleService { // Adjust app icon mimic menubar this.appIcon.style({ - width: `${newAppIconWidth}px`, - 'padding-left': `${newAppIconPaddingLeft}px`, - 'margin-right': `${newControlsWidth - newAppIconWidth - newAppIconPaddingLeft + bufferWidth}px`, + 'width': `${newAppIconWidth}px`, + 'background-size': `${newAppIconSize}px`, + 'margin-right': `${newControlsWidth - newAppIconWidth + bufferWidth}px`, 'padding-top': `${(newHeight - currentAppIconHeight) / 2.0}px`, 'padding-bottom': `${(newHeight - currentAppIconHeight) / 2.0}px` });