diff --git a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts index b2812833309..a5e8f96b51d 100644 --- a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts +++ b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts @@ -159,7 +159,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi // Prevent default to stop editor selecting text #8524 mouseMoveEvent.preventDefault(); // Reduce x by width of drag handle to reduce jarring #16604 - this.setCoordinates(mouseMoveEvent.posx - 14, mouseMoveEvent.posy); + this.setCoordinates(mouseMoveEvent.posx - 14, mouseMoveEvent.posy - this.partService.getTitleBarOffset()); }).once('mouseup', (e: MouseEvent) => { this.storePosition(); this.dragArea.removeClass('dragged'); @@ -167,8 +167,8 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi }); }); - this.toUnbind.push(this.partService.onTitleBarVisibilityChange(() => this.positionDebugWidget())); - this.toUnbind.push(browser.onDidChangeZoomLevel(() => this.positionDebugWidget())); + this.toUnbind.push(this.partService.onTitleBarVisibilityChange(() => this.setYCoordinate())); + this.toUnbind.push(browser.onDidChangeZoomLevel(() => this.setYCoordinate())); } private storePosition(): void { @@ -199,10 +199,9 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi } } - private positionDebugWidget(): void { + private setYCoordinate(y = 0): void { const titlebarOffset = this.partService.getTitleBarOffset(); - - $(this.$el).style('top', `${titlebarOffset}px`); + this.$el.style('top', `${titlebarOffset + y}px`); } private setCoordinates(x?: number, y?: number): void { @@ -223,7 +222,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi } if ((y < HEIGHT / 2) || (y > HEIGHT + HEIGHT / 2)) { const moveToTop = y < HEIGHT; - this.$el.style('top', moveToTop ? '0px' : `${HEIGHT}px`); + this.setYCoordinate(moveToTop ? 0 : HEIGHT); this.storageService.store(DEBUG_ACTIONS_WIDGET_Y_KEY, moveToTop ? 0 : 2 * HEIGHT, StorageScope.GLOBAL); } }