(point: Point, triggerRect: DOMRect, overlayRect?: DOMRect)
| 83 | } |
| 84 | |
| 85 | function isPointInSafeArea(point: Point, triggerRect: DOMRect, overlayRect?: DOMRect): boolean { |
| 86 | if (rectContains(triggerRect, point)) { |
| 87 | return true; |
| 88 | } |
| 89 | if (!overlayRect) { |
| 90 | return false; |
| 91 | } |
| 92 | if (rectContains(overlayRect, point)) { |
| 93 | return true; |
| 94 | } |
| 95 | // Otherwise, check whether the point is within the convex hull connecting the two rects. |
| 96 | let hull = convexHull([...rectCorners(triggerRect), ...rectCorners(overlayRect)]); |
| 97 | return hull.length >= 3 && isPointInPolygon(point, hull); |
| 98 | } |
| 99 | |
| 100 | function rectContains(rect: DOMRect, point: Point): boolean { |
| 101 | return ( |
no test coverage detected