From da124f6c2789ec0aa4f8a0ae917af30de9bd3653 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 26 Feb 2017 12:06:37 -0800 Subject: fix wonky scanning logic --- ext/fg/js/driver.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'ext/fg/js') 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; } } -- cgit v1.2.3