| 71 | const LABEL_PAD = 2; |
| 72 | |
| 73 | function overlapArea(a: ScreenRect, b: ScreenRect): number { |
| 74 | const width = Math.min(a.right, b.right + LABEL_PAD) - Math.max(a.left, b.left - LABEL_PAD); |
| 75 | const height = Math.min(a.bottom, b.bottom + LABEL_PAD) - Math.max(a.top, b.top - LABEL_PAD); |
| 76 | return width > 0 && height > 0 ? width * height : 0; |
| 77 | } |
| 78 | |
| 79 | const SIDES = [0, 1, -1, 2, -2, 3, -3]; |
| 80 | /* Wie nah ein Label seinen Enden kommen darf, wenn es nur so frei steht: dort laufen die Linien eines Knotens zusammen. */ |