From 3bfa1df84aeb6f1b520de90f1520defebe1d5725 Mon Sep 17 00:00:00 2001 From: Options Brewers Date: Fri, 9 Jun 2023 20:27:49 -0700 Subject: [PATCH] Fixes vertical offset check for checkNormalVisible and checkOverflowVisible --- src/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.jsx b/src/index.jsx index 39c1505..c9e1231 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -99,10 +99,10 @@ const checkOverflowVisible = function checkOverflowVisible(component, parent) { : [component.props.offset, component.props.offset]; // Be compatible with previous API return ( - offsetTop - offsets[0] <= intersectionHeight && + offsetTop - offsets[1] <= intersectionHeight && offsetTop + height + offsets[1] >= 0 && offsetLeft - offsets[0] <= intersectionWidth && - offsetLeft + width + offsets[1] >= 0 + offsetLeft + width + offsets[0] >= 0 ); }; @@ -135,7 +135,7 @@ const checkNormalVisible = function checkNormalVisible(component) { : [component.props.offset, component.props.offset]; // Be compatible with previous API return ( - top - offsets[0] <= windowInnerHeight && + top - offsets[1] <= windowInnerHeight && top + elementHeight + offsets[1] >= 0 ); };