summaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-26 18:47:16 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-26 18:59:52 -0500
commit96aad50340b4d0374979ac981cd1c481cc8dcd94 (patch)
treed378d53debce57c1d60498d08ff8a537c9e0b313 /ext/fg/js/frontend.js
parentc2ff25b0ec2fdb8764a5e9994c1e37bfed7f05c6 (diff)
Create DOM utility file
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js14
1 files changed, 1 insertions, 13 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 6002dfcb..81c159db 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -159,7 +159,7 @@ class Frontend {
this.preventNextClick = false;
const primaryTouch = e.changedTouches[0];
- if (Frontend.selectionContainsPoint(window.getSelection(), primaryTouch.clientX, primaryTouch.clientY)) {
+ if (DOM.isPointInSelection(primaryTouch.clientX, primaryTouch.clientY, window.getSelection())) {
return;
}
@@ -456,18 +456,6 @@ class Frontend {
return -1;
}
- static selectionContainsPoint(selection, x, y) {
- for (let i = 0; i < selection.rangeCount; ++i) {
- const range = selection.getRangeAt(i);
- for (const rect of range.getClientRects()) {
- if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
- return true;
- }
- }
- }
- return false;
- }
-
setTextSourceScanLength(textSource, length) {
textSource.setEndOffset(length);
if (this.ignoreNodes === null || !textSource.range) {