From 2f82762ace33a0986c1ec3fc72da83113810dae9 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 6 Oct 2024 15:29:23 +0800 Subject: fix: logic about checking element inside --- src/utils.mjs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/utils.mjs') diff --git a/src/utils.mjs b/src/utils.mjs index ddd3034..dba023a 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -124,12 +124,12 @@ export const insideWindow = element => { export const insideParent = (childElement, parentElement) => { const childRect = childElement.getBoundingClientRect() const parentRect = parentElement.getBoundingClientRect() - const offset = 20 + const offset = 10 return ( - childRect.left > parentRect.left + offset && - childRect.right < parentRect.right - offset && - childRect.top > parentRect.top + offset && - childRect.bottom < parentRect.bottom - offset + childRect.left < parentRect.right - offset && + childRect.right > parentRect.left + offset && + childRect.top < parentRect.bottom - offset && + childRect.bottom > parentRect.top + offset ) } -- cgit v1.2.3-70-g09d2