aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/driver.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/driver.js')
-rw-r--r--ext/fg/js/driver.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 93f46622..1be69f11 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -37,7 +37,6 @@ class Driver {
window.addEventListener('mousedown', this.onMouseDown.bind(this));
window.addEventListener('mousemove', this.onMouseMove.bind(this));
window.addEventListener('keydown', this.onKeyDown.bind(this));
- window.addEventListener('scroll', e => this.hidePopup());
window.addEventListener('resize', e => this.hidePopup());
getOptions().then(opts => {
@@ -65,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();
}
}
@@ -77,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;
}
@@ -98,11 +101,8 @@ 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();
- }
+ this.popupTimerClear();
+ this.hidePopup();
}
onBgMessage({action, params}, sender, callback) {