MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / substantiallyOverlaps

Function substantiallyOverlaps

packages/nativescript-inspector/src/index.ts:1682–1692  ·  view source on GitHub ↗
(
  frame: JSONObject,
  otherFrame: JSONObject | null,
)

Source from the content-addressed store, hash-verified

1680}
1681
1682function 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
1694function rectArea(frame: JSONObject | null | undefined): number {
1695 return rectNumber(frame, "width") * rectNumber(frame, "height");

Callers 1

Calls 2

rectOverlapAreaFunction · 0.85
rectAreaFunction · 0.85

Tested by

no test coverage detected