(a: Rectangle, b: Rectangle)
| 61 | } |
| 62 | |
| 63 | export function unionRect(a: Rectangle, b: Rectangle): Rectangle { |
| 64 | const minX = Math.min(a.x, b.x) |
| 65 | const minY = Math.min(a.y, b.y) |
| 66 | const maxX = Math.max(a.x + a.width, b.x + b.width) |
| 67 | const maxY = Math.max(a.y + a.height, b.y + b.height) |
| 68 | return { x: minX, y: minY, width: maxX - minX, height: maxY - minY } |
| 69 | } |
| 70 | |
| 71 | export function clampRect(rect: Rectangle, size: Size): Rectangle { |
| 72 | const minX = Math.max(0, rect.x) |
no test coverage detected