aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-10-17 09:14:49 -0700
committerAlex Yatskov <alex@foosoft.net>2016-10-17 09:14:49 -0700
commitf22fcb0a5d5ef5b3003fbfabf21713bc889d0942 (patch)
treee3a2b058ad8ddf6f1897666c1d1bcf46eade9561
parentaa1a2b01763aab7e0880ec20f8c05bdd11e94c5d (diff)
Cleanup, reset scroll position on definition lookup (#20)
-rw-r--r--ext/fg/js/driver.js6
-rw-r--r--ext/fg/js/popup.js2
2 files changed, 6 insertions, 2 deletions
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);