limit popup depth live
This commit is contained in:
parent
61a96e327a
commit
1df59d57b5
@ -30,7 +30,8 @@ class Frontend extends TextScanner {
|
|||||||
super(
|
super(
|
||||||
window,
|
window,
|
||||||
popup.isProxy() ? [] : [popup.getContainer()],
|
popup.isProxy() ? [] : [popup.getContainer()],
|
||||||
[(x, y) => this.popup.containsPoint(x, y)]
|
[(x, y) => this.popup.containsPoint(x, y)],
|
||||||
|
() => this.popup.depth <= this.options.scanning.popupNestingMaxDepth
|
||||||
);
|
);
|
||||||
|
|
||||||
this.popup = popup;
|
this.popup = popup;
|
||||||
|
@ -22,11 +22,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class TextScanner {
|
class TextScanner {
|
||||||
constructor(node, ignoreElements, ignorePoints) {
|
constructor(node, ignoreElements, ignorePoints, canEnable=null) {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
this.ignoreElements = ignoreElements;
|
this.ignoreElements = ignoreElements;
|
||||||
this.ignorePoints = ignorePoints;
|
this.ignorePoints = ignorePoints;
|
||||||
|
|
||||||
|
this.canEnable = canEnable;
|
||||||
|
|
||||||
this.ignoreNodes = null;
|
this.ignoreNodes = null;
|
||||||
|
|
||||||
this.scanTimerPromise = null;
|
this.scanTimerPromise = null;
|
||||||
@ -225,6 +227,10 @@ class TextScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setEnabled(enabled) {
|
setEnabled(enabled) {
|
||||||
|
if (this.canEnable !== null && !this.canEnable()) {
|
||||||
|
enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
if (!this.enabled) {
|
if (!this.enabled) {
|
||||||
this.hookEvents();
|
this.hookEvents();
|
||||||
|
Loading…
Reference in New Issue
Block a user