mouse event fixes for firefox

This commit is contained in:
Alex Yatskov 2017-02-26 12:01:14 -08:00
parent 003e36ba84
commit ec0aded9bb

View File

@ -22,6 +22,7 @@ class Driver {
this.popup = new Popup(); this.popup = new Popup();
this.popupTimer = null; this.popupTimer = null;
this.lastMousePos = null; this.lastMousePos = null;
this.leftMouseDown = false;
this.lastTextSource = null; this.lastTextSource = null;
this.pendingLookup = false; this.pendingLookup = false;
this.options = null; this.options = null;
@ -30,6 +31,7 @@ class Driver {
this.options = options; this.options = options;
window.addEventListener('mouseover', this.onMouseOver.bind(this)); window.addEventListener('mouseover', this.onMouseOver.bind(this));
window.addEventListener('mousedown', this.onMouseDown.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('mousemove', this.onMouseMove.bind(this));
window.addEventListener('resize', e => this.searchClear()); window.addEventListener('resize', e => this.searchClear());
chrome.runtime.onMessage.addListener(this.onBgMessage.bind(this)); chrome.runtime.onMessage.addListener(this.onBgMessage.bind(this));
@ -62,9 +64,9 @@ class Driver {
return; return;
} }
// if (e.which === 1 /* lmb */) { if (this.leftMouseDown) {
// return; return;
// } }
if (this.options.scanning.requireShift && !e.shiftKey) { if (this.options.scanning.requireShift && !e.shiftKey) {
return; return;
@ -82,6 +84,16 @@ class Driver {
this.lastMousePos = {x: e.clientX, y: e.clientY}; this.lastMousePos = {x: e.clientX, y: e.clientY};
this.popupTimerClear(); this.popupTimerClear();
this.searchClear(); this.searchClear();
if (e.which === 1) {
this.leftMouseDown = true;
}
}
onMouseUp(e) {
if (e.which === 1) {
this.leftMouseDown = false;
}
} }
onBgMessage({action, params}, sender, callback) { onBgMessage({action, params}, sender, callback) {