From f22fcb0a5d5ef5b3003fbfabf21713bc889d0942 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 17 Oct 2016 09:14:49 -0700 Subject: Cleanup, reset scroll position on definition lookup (#20) --- ext/fg/js/driver.js | 6 ++++-- ext/fg/js/popup.js | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'ext/fg') diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js index f1a0be9f..280a7dca 100644 --- a/ext/fg/js/driver.js +++ b/ext/fg/js/driver.js @@ -100,9 +100,11 @@ class Driver { } onMouseDown(e) { + this.lastMousePos = {x: e.clientX, y: e.clientY}; + this.popupTimerClear(); + if (this.popup.visible()) { - const selection = window.getSelection(); - selection.removeAllRanges(); + this.hidePopup(); } } diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 83da3fe1..2a2f7c54 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -66,6 +66,8 @@ class Popup { return; } + this.container.contentWindow.scrollTo(0, 0); + const doc = this.container.contentDocument; doc.open(); doc.write(content); -- cgit v1.2.3