Move window border widget into layout service

Part of #104508
This commit is contained in:
Daniel Imms
2020-08-31 15:41:33 -07:00
parent fb80351278
commit 5c3fdb8d42
4 changed files with 11 additions and 1 deletions
+4
View File
@@ -1616,6 +1616,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return this.state.windowBorder;
}
getWindowBorderWidth(): number {
return this.state.windowBorder ? 2 : 0;
}
getWindowBorderRadius(): string | undefined {
return this.state.windowBorder && isMacintosh ? '5px' : undefined;
}
@@ -143,7 +143,7 @@ export class HoverWidget extends Widget {
// Get horizontal alignment and position
let targetLeft = this._target.x !== undefined ? this._target.x : Math.min(...targetBounds.map(e => e.left));
if (targetLeft + this._hover.containerDomNode.clientWidth >= document.documentElement.clientWidth) {
this._x = document.documentElement.clientWidth - (this._workbenchLayoutService.hasWindowBorder() ? 3 : 1);
this._x = document.documentElement.clientWidth - this._workbenchLayoutService.getWindowBorderWidth() - 1;
this._hover.containerDomNode.classList.add('right-aligned');
} else {
this._x = targetLeft;
@@ -144,6 +144,11 @@ export interface IWorkbenchLayoutService extends ILayoutService {
*/
hasWindowBorder(): boolean;
/**
* Returns the window border width.
*/
getWindowBorderWidth(): number;
/**
* Returns the window border radius if any.
*/
@@ -429,6 +429,7 @@ export class TestLayoutService implements IWorkbenchLayoutService {
hasFocus(_part: Parts): boolean { return false; }
focusPart(_part: Parts): void { }
hasWindowBorder(): boolean { return false; }
getWindowBorderWidth(): number { return 0; }
getWindowBorderRadius(): string | undefined { return undefined; }
isVisible(_part: Parts): boolean { return true; }
getDimension(_part: Parts): Dimension { return new Dimension(0, 0); }