aboutsummaryrefslogtreecommitdiff
path: root/ext/js/language
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2022-09-20 21:06:39 -0400
committerGitHub <noreply@github.com>2022-09-20 21:06:39 -0400
commit480869c3d1d820b344d23989d2deae64a594869e (patch)
treebc1d0c5143b71e312322e3dc851cb2c98050b8c6 /ext/js/language
parentac373a67944a3241f96091b2bcd94f1b337a3940 (diff)
Exclude documentElement from zoom calculation (#2227)
* Exclude documentElement from zoom calculation * Add an option * Refactor zoom coordinate conversion functions * Convert zoom coordinates for text sources * Rename variable * Convert rect coordinate spaces * Handle shadow DOM
Diffstat (limited to 'ext/js/language')
-rw-r--r--ext/js/language/text-scanner.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js
index 93de4dd4..3b8a8b47 100644
--- a/ext/js/language/text-scanner.js
+++ b/ext/js/language/text-scanner.js
@@ -54,6 +54,7 @@ class TextScanner extends EventDispatcher {
this._selectionRestoreInfo = null;
this._deepContentScan = false;
+ this._normalizeCssZoom = true;
this._selectText = false;
this._delay = 0;
this._touchInputEnabled = false;
@@ -151,6 +152,7 @@ class TextScanner extends EventDispatcher {
setOptions({
inputs,
deepContentScan,
+ normalizeCssZoom,
selectText,
delay,
touchInputEnabled,
@@ -167,6 +169,9 @@ class TextScanner extends EventDispatcher {
if (typeof deepContentScan === 'boolean') {
this._deepContentScan = deepContentScan;
}
+ if (typeof normalizeCssZoom === 'boolean') {
+ this._normalizeCssZoom = normalizeCssZoom;
+ }
if (typeof selectText === 'boolean') {
this._selectText = selectText;
}
@@ -932,7 +937,10 @@ class TextScanner extends EventDispatcher {
return;
}
- const textSource = this._documentUtil.getRangeFromPoint(x, y, this._deepContentScan);
+ const textSource = this._documentUtil.getRangeFromPoint(x, y, {
+ deepContentScan: this._deepContentScan,
+ normalizeCssZoom: this._normalizeCssZoom
+ });
try {
await this._search(textSource, searchTerms, searchKanji, inputInfo);
} finally {