(x: number, y: number, width: number, height: number, [insetX, insetY]: [number, number])
| 23 | |
| 24 | /** The space a label centred at (x, y) claims; a negative inset keeps a margin around an estimate. */ |
| 25 | export function labelRect(x: number, y: number, width: number, height: number, [insetX, insetY]: [number, number]): LabelRect { |
| 26 | return { left: x - width / 2 + insetX, right: x + width / 2 - insetX, top: y - height / 2 + insetY, bottom: y + height / 2 - insetY }; |
| 27 | } |
| 28 | |
| 29 | export const labelsCollide = (a: LabelRect, b: LabelRect): boolean => |
| 30 | a.left < b.right && a.right > b.left && a.top < b.bottom && a.bottom > b.top; |
no outgoing calls
no test coverage detected