(a: IRectangle, b: IRectangle)
| 295 | } |
| 296 | |
| 297 | private intersectRects(a: IRectangle, b: IRectangle): IRectangle { |
| 298 | const x = Math.max(a.x, b.x); |
| 299 | const y = Math.max(a.y, b.y); |
| 300 | const right = Math.min(a.x + a.width, b.x + b.width); |
| 301 | const bottom = Math.min(a.y + a.height, b.y + b.height); |
| 302 | |
| 303 | return { |
| 304 | x, |
| 305 | y, |
| 306 | width: Math.max(0, right - x), |
| 307 | height: Math.max(0, bottom - y) |
| 308 | }; |
| 309 | } |
| 310 | } |
no test coverage detected