From def32e0b7ca803bce87cbedd2e8b844a375dd2ff Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 9 Apr 2018 12:23:40 +0200 Subject: [PATCH] Fixes #10371: Don't render content widgets if the anchor position is outside the viewport --- .../editor/browser/viewParts/contentWidgets/contentWidgets.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts b/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts index 93934f1131b..0fc4b4ef5ea 100644 --- a/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts +++ b/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts @@ -308,7 +308,8 @@ class Widget { private _layoutBoxInPage(topLeft: Coordinate, width: number, height: number, ctx: RenderingContext): IBoxLayoutResult { let left0 = topLeft.left - ctx.scrollLeft; - if (left0 + width < 0 || left0 > this._contentWidth) { + if (left0 < 0 || left0 > this._contentWidth) { + // Don't render if position is scrolled outside viewport return null; } @@ -390,6 +391,7 @@ class Widget { } if (this.allowEditorOverflow) { + console.log(`here i am: ${JSON.stringify(topLeft)}`); placement = this._layoutBoxInPage(topLeft, this._cachedDomNodeClientWidth, this._cachedDomNodeClientHeight, ctx); } else { placement = this._layoutBoxInViewport(topLeft, this._cachedDomNodeClientWidth, this._cachedDomNodeClientHeight, ctx);