Make text easier to select in hover mode (#18)

This commit is contained in:
Alex Yatskov 2016-10-17 09:01:43 -07:00
parent bc8ef56cc2
commit aa1a2b0176

View File

@ -64,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();
}
}
@ -76,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;
}
@ -96,11 +100,9 @@ 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();
if (this.popup.visible()) {
const selection = window.getSelection();
selection.removeAllRanges();
}
}