From e0df9a53c7cbd6fbae50c59dc176d7f202b997e1 Mon Sep 17 00:00:00 2001 From: sunhao Date: Tue, 18 Jun 2024 12:15:03 +0800 Subject: [PATCH] * core: add checkZeroSize option to isVisible helper. --- lib/core/src/dom/is-visible.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/src/dom/is-visible.ts b/lib/core/src/dom/is-visible.ts index a4c26529d4..b221f2c15a 100644 --- a/lib/core/src/dom/is-visible.ts +++ b/lib/core/src/dom/is-visible.ts @@ -8,6 +8,7 @@ type ISVisibleOptions = { fullyCheck?: boolean; viewport?: {left: number, top: number, width: number, height: number} | DOMRectReadOnly; container?: Comparator; + checkZeroSize?: boolean; }; /** @@ -26,7 +27,7 @@ export function isVisible(selector: Selector, options: ISVisibleOptions = {}): b let {viewport} = options; const {left, top, width, height} = element.getBoundingClientRect(); - if (!(width * height)) { + if (options.checkZeroSize && !(width * height)) { return false; } if (!viewport) {