summaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-08-17 19:05:31 -0700
committerAlex Yatskov <alex@foosoft.net>2017-08-17 19:05:31 -0700
commit0c650dac828b7ab9641396268a66d3a7410d4000 (patch)
treed8499a1f68a28049f785ff077eaf740689c93f0e /ext/fg/js/frontend.js
parent84d2204d966342fa03635b4b8a860bb48a418bc0 (diff)
don't show busy spinner while waiting for card info
smoother cursor movement in firefox
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 58a721bf..41c93f00 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -21,7 +21,6 @@ class Frontend {
constructor() {
this.popup = new Popup();
this.popupTimer = null;
- this.mousePosLast = null;
this.mouseDownLeft = false;
this.mouseDownMiddle = false;
this.textSourceLast = null;
@@ -53,7 +52,6 @@ class Frontend {
}
onMouseMove(e) {
- this.mousePosLast = {x: e.clientX, y: e.clientY};
this.popupTimerClear();
if (!this.options.general.enable) {
@@ -64,6 +62,10 @@ class Frontend {
return;
}
+ if (this.pendingLookup) {
+ return;
+ }
+
const mouseScan = this.mouseDownMiddle && this.options.scanning.middleMouse;
const keyScan =
this.options.scanning.modifier === 'alt' && e.altKey ||
@@ -75,11 +77,19 @@ class Frontend {
return;
}
- const searchFunc = () => this.searchAt(this.mousePosLast);
+ const search = async () => {
+ try {
+ await this.searchAt({x: e.clientX, y: e.clientY});
+ this.pendingLookup = false;
+ } catch (e) {
+ this.onError(e);
+ }
+ };
+
if (this.options.scanning.modifier === 'none') {
- this.popupTimerSet(searchFunc);
+ this.popupTimerSet(search);
} else {
- searchFunc();
+ search();
}
}