diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-02-26 12:06:37 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-02-26 12:06:37 -0800 |
commit | da124f6c2789ec0aa4f8a0ae917af30de9bd3653 (patch) | |
tree | 80ba315d7574d6f39ae953d0f2929e8a6309303c | |
parent | ec0aded9bb39c6ff148d842d1a72b3b4ff4d904c (diff) |
fix wonky scanning logic
-rw-r--r-- | ext/fg/js/driver.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js index 515bb463..6ea7fbaf 100644 --- a/ext/fg/js/driver.js +++ b/ext/fg/js/driver.js @@ -22,7 +22,8 @@ class Driver { this.popup = new Popup(); this.popupTimer = null; this.lastMousePos = null; - this.leftMouseDown = false; + this.mouseDownLeft = false; + this.mouseDownMiddle = false; this.lastTextSource = null; this.pendingLookup = false; this.options = null; @@ -64,16 +65,16 @@ class Driver { return; } - if (this.leftMouseDown) { + if (this.mouseDownLeft) { return; } - if (this.options.scanning.requireShift && !e.shiftKey) { + if (this.options.scanning.requireShift && !e.shiftKey && !this.mouseDownMiddle) { return; } const searcher = () => this.searchAt(this.lastMousePos); - if (!this.popup.isVisible() || e.shiftKey || e.which === 2 /* mmb */) { + if (this.popup.isVisible()) { searcher(); } else { this.popupTimerSet(searcher); @@ -86,13 +87,17 @@ class Driver { this.searchClear(); if (e.which === 1) { - this.leftMouseDown = true; + this.mouseDownLeft = true; + } else if (e.which === 2) { + this.mouseDownMiddle = true; } } onMouseUp(e) { if (e.which === 1) { - this.leftMouseDown = false; + this.mouseDownLeft = false; + } else if (e.which === 2) { + this.mouseDownMiddle = false; } } |