diff options
| -rw-r--r-- | src/utils.mjs | 10 |
1 files changed, 5 insertions, 5 deletions
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 => { | |||
| 124 | export const insideParent = (childElement, parentElement) => { | 124 | export const insideParent = (childElement, parentElement) => { |
| 125 | const childRect = childElement.getBoundingClientRect() | 125 | const childRect = childElement.getBoundingClientRect() |
| 126 | const parentRect = parentElement.getBoundingClientRect() | 126 | const parentRect = parentElement.getBoundingClientRect() |
| 127 | const offset = 20 | 127 | const offset = 10 |
| 128 | 128 | ||
| 129 | return ( | 129 | return ( |
| 130 | childRect.left > parentRect.left + offset && | 130 | childRect.left < parentRect.right - offset && |
| 131 | childRect.right < parentRect.right - offset && | 131 | childRect.right > parentRect.left + offset && |
| 132 | childRect.top > parentRect.top + offset && | 132 | childRect.top < parentRect.bottom - offset && |
| 133 | childRect.bottom < parentRect.bottom - offset | 133 | childRect.bottom > parentRect.top + offset |
| 134 | ) | 134 | ) |
| 135 | } | 135 | } |