aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/driver.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-05-25 23:06:10 -0700
committerAlex Yatskov <alex@foosoft.net>2017-05-25 23:06:10 -0700
commit16baf9a400ac11a1c4f53ba6665db03a900511e0 (patch)
tree685096179093f112a9263f15d3cf081f50e9634d /ext/fg/js/driver.js
parent1cdf496824709b4e4579d700c333e832d790925e (diff)
parent618a3cb319c247c7196b1b83389d5f43241ab0c6 (diff)
Merge branch 'master' into firefox-amo
Diffstat (limited to 'ext/fg/js/driver.js')
-rw-r--r--ext/fg/js/driver.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index e94a4ac2..b0cc4613 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -70,15 +70,22 @@ window.driver = new class {
return;
}
- if (this.options.scanning.requireShift && !e.shiftKey && !(this.mouseDownMiddle && this.options.scanning.middleMouse)) {
+ const mouseScan = this.mouseDownMiddle && this.options.scanning.middleMouse;
+ const keyScan =
+ this.options.scanning.modifier === 'alt' && e.altKey ||
+ this.options.scanning.modifier === 'ctrl' && e.ctrlKey ||
+ this.options.scanning.modifier === 'shift' && e.shiftKey ||
+ this.options.scanning.modifier === 'none';
+
+ if (!keyScan && !mouseScan) {
return;
}
const searchFunc = () => this.searchAt(this.lastMousePos);
- if (this.options.scanning.requireShift) {
- searchFunc();
- } else {
+ if (this.options.scanning.modifier === 'none') {
this.popupTimerSet(searchFunc);
+ } else {
+ searchFunc();
}
}
@@ -142,8 +149,9 @@ window.driver = new class {
return;
}
- const textSource = docRangeFromPoint(point, this.options.scanning.imposter);
+ const textSource = docRangeFromPoint(point);
if (!textSource || !textSource.containsPoint(point)) {
+ docImposterDestroy();
return;
}
@@ -159,6 +167,7 @@ window.driver = new class {
}).catch(error => {
this.handleError(error, textSource);
}).then(() => {
+ docImposterDestroy();
this.pendingLookup = false;
});
}
@@ -230,7 +239,7 @@ window.driver = new class {
handleError(error, textSource) {
if (window.orphaned) {
- if (textSource && this.options.scanning.requireShift) {
+ if (textSource && this.options.scanning.modifier !== 'none') {
this.popup.showOrphaned(textSource.getRect(), this.options);
}
} else {