Widget offset is relative to editor in standalone editor

This commit is contained in:
Ramya Achutha Rao
2017-06-26 16:54:45 -07:00
parent 8f5ca20e73
commit 97331424b1

View File

@@ -947,8 +947,9 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
const editorCoords = getDomNodePagePosition(this.editor.getDomNode());
const cursorX = editorCoords.left + cursorCoords.left;
const cursorY = editorCoords.top + cursorCoords.top + cursorCoords.height;
const widgetX = this.element.offsetLeft;
const widgetY = this.element.offsetTop;
const widgetCoords = getDomNodePagePosition(this.element);
const widgetX = widgetCoords.left;
const widgetY = widgetCoords.top;
if (widgetX < cursorX - this.listWidth) {
// Widget is too far to the left of cursor, swap list and docs