summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-02-26 12:01:14 -0800
committerAlex Yatskov <alex@foosoft.net>2017-02-26 12:01:14 -0800
commitec0aded9bb39c6ff148d842d1a72b3b4ff4d904c (patch)
treea99e1807d35e832db531bf8dbdcf226b02da30e9 /ext/fg/js
parent003e36ba841677b479c836f2b36284c0dc5fcc9f (diff)
mouse event fixes for firefox
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/driver.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 9d972abf..515bb463 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -22,6 +22,7 @@ class Driver {
this.popup = new Popup();
this.popupTimer = null;
this.lastMousePos = null;
+ this.leftMouseDown = false;
this.lastTextSource = null;
this.pendingLookup = false;
this.options = null;
@@ -30,6 +31,7 @@ class Driver {
this.options = options;
window.addEventListener('mouseover', this.onMouseOver.bind(this));
window.addEventListener('mousedown', this.onMouseDown.bind(this));
+ window.addEventListener('mouseup', this.onMouseUp.bind(this));
window.addEventListener('mousemove', this.onMouseMove.bind(this));
window.addEventListener('resize', e => this.searchClear());
chrome.runtime.onMessage.addListener(this.onBgMessage.bind(this));
@@ -62,9 +64,9 @@ class Driver {
return;
}
- // if (e.which === 1 /* lmb */) {
- // return;
- // }
+ if (this.leftMouseDown) {
+ return;
+ }
if (this.options.scanning.requireShift && !e.shiftKey) {
return;
@@ -82,6 +84,16 @@ class Driver {
this.lastMousePos = {x: e.clientX, y: e.clientY};
this.popupTimerClear();
this.searchClear();
+
+ if (e.which === 1) {
+ this.leftMouseDown = true;
+ }
+ }
+
+ onMouseUp(e) {
+ if (e.which === 1) {
+ this.leftMouseDown = false;
+ }
}
onBgMessage({action, params}, sender, callback) {