12 lines
317 B
TypeScript
12 lines
317 B
TypeScript
export function intersectRect(
|
|
a: { x: number; y: number; width: number; height: number },
|
|
b: { x: number; y: number; width: number; height: number }
|
|
): boolean {
|
|
return !(
|
|
b.x > a.x + a.width ||
|
|
b.x + b.width < a.x ||
|
|
b.y > a.y + a.height ||
|
|
b.y + b.height < a.y
|
|
);
|
|
}
|