| 6189 | } |
| 6190 | } |
| 6191 | function stickify(node) { |
| 6192 | var children = node.children; |
| 6193 | if (children && children.length) { |
| 6194 | var rect = pad(node), remaining = children.slice(), child, row = []; |
| 6195 | scale(remaining, rect.dx * rect.dy / node.value); |
| 6196 | row.area = 0; |
| 6197 | while (child = remaining.pop()) { |
| 6198 | row.push(child); |
| 6199 | row.area += child.area; |
| 6200 | if (child.z != null) { |
| 6201 | position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length); |
| 6202 | row.length = row.area = 0; |
| 6203 | } |
| 6204 | } |
| 6205 | children.forEach(stickify); |
| 6206 | } |
| 6207 | } |
| 6208 | function worst(row, u) { |
| 6209 | var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length; |
| 6210 | while (++i < n) { |