diff options
Diffstat (limited to 'ext/fg/js/document.js')
| -rw-r--r-- | ext/fg/js/document.js | 19 | 
1 files changed, 2 insertions, 17 deletions
| diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js index 8161c85a..3dd12a40 100644 --- a/ext/fg/js/document.js +++ b/ext/fg/js/document.js @@ -223,7 +223,7 @@ function isPointInRange(x, y, range) {          const {node, offset, content} = TextSourceRange.seekForward(range.endContainer, range.endOffset, 1);          range.setEnd(node, offset); -        if (!isWhitespace(content) && isPointInAnyRect(x, y, range.getClientRects())) { +        if (!isWhitespace(content) && DOM.isPointInAnyRect(x, y, range.getClientRects())) {              return true;          }      } finally { @@ -234,7 +234,7 @@ function isPointInRange(x, y, range) {      const {node, offset, content} = TextSourceRange.seekBackward(range.startContainer, range.startOffset, 1);      range.setStart(node, offset); -    if (!isWhitespace(content) && isPointInAnyRect(x, y, range.getClientRects())) { +    if (!isWhitespace(content) && DOM.isPointInAnyRect(x, y, range.getClientRects())) {          // This purposefully leaves the starting offset as modified and sets the range length to 0.          range.setEnd(node, offset);          return true; @@ -248,21 +248,6 @@ function isWhitespace(string) {      return string.trim().length === 0;  } -function isPointInAnyRect(x, y, rects) { -    for (const rect of rects) { -        if (isPointInRect(x, y, rect)) { -            return true; -        } -    } -    return false; -} - -function isPointInRect(x, y, rect) { -    return ( -        x >= rect.left && x < rect.right && -        y >= rect.top && y < rect.bottom); -} -  const caretRangeFromPoint = (() => {      if (typeof document.caretRangeFromPoint === 'function') {          // Chrome, Edge |