aboutsummaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-24 21:38:19 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-28 17:03:42 -0400
commit9703e123bf7467fc990e6d38e59bcc5fd46645b8 (patch)
tree0468d0321f56c020c9eac18b70e26b8937c7e145 /ext/fg
parent80eb3575276e6499824b4ac71782f1a6c87c43ac (diff)
Remove setPrimaryTouch
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/frontend.js67
1 files changed, 29 insertions, 38 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 223088a1..8d51c1df 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -168,7 +168,28 @@ class Frontend {
return;
}
- this.setPrimaryTouch(primaryTouch);
+ this.primaryTouchIdentifier = primaryTouch.identifier;
+ this.preventScroll = false;
+ this.preventNextContextMenu = false;
+ this.preventNextMouseDown = false;
+ this.preventNextClick = false;
+
+ const textSourceCurrentPrevious = this.textSourceCurrent !== null ? this.textSourceCurrent.clone() : null;
+
+ this.searchAt(primaryTouch.clientX, primaryTouch.clientY, 'touchStart')
+ .then(() => {
+ if (
+ this.pendingLookup ||
+ this.textSourceCurrent === null ||
+ this.textSourceCurrent.equals(textSourceCurrentPrevious)
+ ) {
+ return;
+ }
+
+ this.preventScroll = true;
+ this.preventNextContextMenu = true;
+ this.preventNextMouseDown = true;
+ });
}
onTouchEnd(e) {
@@ -179,7 +200,13 @@ class Frontend {
return;
}
- this.setPrimaryTouch(null);
+ this.primaryTouchIdentifier = null;
+ this.preventScroll = false;
+ this.preventNextClick = false;
+ // Don't revert context menu and mouse down prevention,
+ // since these events can occur after the touch has ended.
+ // this.preventNextContextMenu = false;
+ // this.preventNextMouseDown = false;
}
onTouchCancel(e) {
@@ -419,42 +446,6 @@ class Frontend {
return -1;
}
- setPrimaryTouch(touch) {
- if (touch === null) {
- this.primaryTouchIdentifier = null;
- this.preventScroll = false;
- this.preventNextClick = false;
- // Don't revert context menu and mouse down prevention,
- // since these events can occur after the touch has ended.
- // this.preventNextContextMenu = false;
- // this.preventNextMouseDown = false;
- }
- else {
- this.primaryTouchIdentifier = touch.identifier;
- this.preventScroll = false;
- this.preventNextContextMenu = false;
- this.preventNextMouseDown = false;
- this.preventNextClick = false;
-
- const textSourceCurrentPrevious = this.textSourceCurrent !== null ? this.textSourceCurrent.clone() : null;
-
- this.searchAt(touch.clientX, touch.clientY, 'touchStart')
- .then(() => {
- if (
- this.pendingLookup ||
- this.textSourceCurrent === null ||
- this.textSourceCurrent.equals(textSourceCurrentPrevious)
- ) {
- return;
- }
-
- this.preventScroll = true;
- this.preventNextContextMenu = true;
- this.preventNextMouseDown = true;
- });
- }
- }
-
static selectionContainsPoint(selection, x, y) {
for (let i = 0; i < selection.rangeCount; ++i) {
const range = selection.getRangeAt(i);