summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-10-17 09:01:43 -0700
committerAlex Yatskov <alex@foosoft.net>2016-10-17 09:01:43 -0700
commitaa1a2b01763aab7e0880ec20f8c05bdd11e94c5d (patch)
treef055c3a271b246f0844c557bf8f5ea2c73a931cd /ext/fg/js
parentbc8ef56cc2fca745a2e9f7d3d4287f970e1b51d6 (diff)
Make text easier to select in hover mode (#18)
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/driver.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 315a3be6..f1a0be9f 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -64,7 +64,7 @@ class Driver {
if (this.enabled && this.lastMousePos !== null && e.keyCode === 16 /* shift */) {
this.searchAt(this.lastMousePos, true);
- } else if (e.keyCode === 27) {
+ } else if (e.keyCode === 27 /* esc */) {
this.hidePopup();
}
}
@@ -76,13 +76,17 @@ class Driver {
}
onMouseMove(e) {
+ this.lastMousePos = {x: e.clientX, y: e.clientY};
this.popupTimerClear();
- this.lastMousePos = {x: e.clientX, y: e.clientY};
if (!this.enabled) {
return;
}
+ if (e.which === 1 /* lmb */) {
+ return;
+ }
+
if (this.options.holdShiftToScan && !e.shiftKey) {
return;
}
@@ -96,11 +100,9 @@ class Driver {
}
onMouseDown(e) {
- this.lastMousePos = {x: e.clientX, y: e.clientY};
- if (this.enabled && (e.shiftKey || !this.options.holdShiftToScan || e.which === 2 /* mmb */)) {
- this.searchAt(this.lastMousePos, true);
- } else {
- this.hidePopup();
+ if (this.popup.visible()) {
+ const selection = window.getSelection();
+ selection.removeAllRanges();
}
}