diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-18 08:11:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-18 13:11:47 +0000 |
commit | cfc65c31313731dfa0d36c2eceaca35e9d50992f (patch) | |
tree | ec96ec7ab1c3dae559fe5d7930c186347fb64a25 /ext/js/dom/text-source-generator.js | |
parent | 6cf38229b54efbbc3ae7bc174c3999f9dfa7b1d2 (diff) |
Refactor DocumentUtil (#706)
* Refactor DocumentUtil
* Isolate suppression
Diffstat (limited to 'ext/js/dom/text-source-generator.js')
-rw-r--r-- | ext/js/dom/text-source-generator.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/js/dom/text-source-generator.js b/ext/js/dom/text-source-generator.js index 83c7271c..68bf036a 100644 --- a/ext/js/dom/text-source-generator.js +++ b/ext/js/dom/text-source-generator.js @@ -15,7 +15,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import {DocumentUtil} from './document-util.js'; +import {computeZoomScale, isPointInAnyRect} from './document-util.js'; import {DOMTextScanner} from './dom-text-scanner.js'; import {TextSourceElement} from './text-source-element.js'; import {TextSourceRange} from './text-source-range.js'; @@ -358,7 +358,7 @@ export class TextSourceGenerator { // Convert CSS zoom coordinates if (normalizeCssZoom) { - const scale = DocumentUtil.computeZoomScale(startContainer); + const scale = computeZoomScale(startContainer); x /= scale; y /= scale; } @@ -370,7 +370,7 @@ export class TextSourceGenerator { const {node, offset, content} = new DOMTextScanner(nodePre, offsetPre, true, false).seek(1); range.setEnd(node, offset); - if (!this._isWhitespace(content) && DocumentUtil.isPointInAnyRect(x, y, range.getClientRects())) { + if (!this._isWhitespace(content) && isPointInAnyRect(x, y, range.getClientRects())) { return true; } } finally { @@ -381,7 +381,7 @@ export class TextSourceGenerator { const {node, offset, content} = new DOMTextScanner(startContainer, range.startOffset, true, false).seek(-1); range.setStart(node, offset); - if (!this._isWhitespace(content) && DocumentUtil.isPointInAnyRect(x, y, range.getClientRects())) { + if (!this._isWhitespace(content) && 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; |