From 96aad50340b4d0374979ac981cd1c481cc8dcd94 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 26 Nov 2019 18:47:16 -0500 Subject: Create DOM utility file --- ext/fg/js/frontend.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'ext/fg/js/frontend.js') 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) { -- cgit v1.2.3