( frame: JSONObject, otherFrame: JSONObject | null, )
| 1680 | } |
| 1681 | |
| 1682 | function substantiallyOverlaps( |
| 1683 | frame: JSONObject, |
| 1684 | otherFrame: JSONObject | null, |
| 1685 | ): boolean { |
| 1686 | if (!otherFrame) { |
| 1687 | return false; |
| 1688 | } |
| 1689 | const overlap = rectOverlapArea(frame, otherFrame); |
| 1690 | const smallerArea = Math.min(rectArea(frame), rectArea(otherFrame)); |
| 1691 | return smallerArea > 0 && overlap / smallerArea > 0.6; |
| 1692 | } |
| 1693 | |
| 1694 | function rectArea(frame: JSONObject | null | undefined): number { |
| 1695 | return rectNumber(frame, "width") * rectNumber(frame, "height"); |
no test coverage detected