* Returns whether this rectangle intersects another rectangle. * * @param rect - The rectangle to check.
(rect: Rect)
| 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. |
no outgoing calls
no test coverage detected