MCPcopy Create free account
hub / github.com/adobe/react-spectrum / intersects

Method intersects

packages/react-stately/src/virtualizer/Rect.ts:95–104  ·  view source on GitHub ↗

* Returns whether this rectangle intersects another rectangle. * * @param rect - The rectangle to check.

(rect: Rect)

Source from the content-addressed store, hash-verified

93 * @param rect - The rectangle to check.
94 */
95 intersects(rect: Rect): boolean {
96 let isTestEnv = process.env.NODE_ENV === 'test' && !process.env.VIRT_ON;
97 return (
98 (isTestEnv || (this.area > 0 && rect.area > 0)) &&
99 this.x <= rect.x + rect.width &&
100 rect.x <= this.x + this.width &&
101 this.y <= rect.y + rect.height &&
102 rect.y <= this.y + this.height
103 );
104 }
105
106 /**
107 * Returns whether this rectangle fully contains another rectangle.

Callers 10

intersectionMethod · 0.95
isVisibleMethod · 0.80
isValidMethod · 0.80
getVisibleLayoutInfosMethod · 0.80
getVisibleLayoutInfosMethod · 0.80
keyAtPointMethod · 0.80
isVisibleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected