| 846 | let line = 0; |
| 847 | let width = 0; |
| 848 | const spread = (list: string[], left: number): void => { |
| 849 | if (list.length === 0) return; |
| 850 | let lx = left; |
| 851 | for (const id of list) { |
| 852 | const bw = widthOf(id); |
| 853 | if (lx > left && lx + bw - left > lineMax) { |
| 854 | line += 1; |
| 855 | lx = left; |
| 856 | } |
| 857 | pos.set(id, { x: lx, line }); |
| 858 | width = Math.max(width, lx + bw); |
| 859 | lx += bw + NODE_GAP; |
| 860 | } |
| 861 | line += 1; |
| 862 | }; |
| 863 | const place = (id: string, depth: number): void => { |
| 864 | const x = Math.min(depth, CLUSTER_DEPTH_MAX) * CLUSTER_INDENT; |
| 865 | pos.set(id, { x, line }); |