()
| 238 | } |
| 239 | |
| 240 | recomputeInsideNodes(): void { |
| 241 | if (!this.graph) throw new NullGraphError() |
| 242 | const { nodes, reroutes, groups } = this.graph |
| 243 | const children = this._children |
| 244 | this._nodes.length = 0 |
| 245 | children.clear() |
| 246 | |
| 247 | // Move nodes we overlap the centre point of |
| 248 | for (const node of nodes) { |
| 249 | if (containsCentre(this._bounding, node.boundingRect)) { |
| 250 | this._nodes.push(node) |
| 251 | children.add(node) |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | // Move reroutes we overlap the centre point of |
| 256 | for (const reroute of reroutes.values()) { |
| 257 | if (isPointInRect(reroute.pos, this._bounding)) |
| 258 | children.add(reroute) |
| 259 | } |
| 260 | |
| 261 | // Move groups we wholly contain |
| 262 | for (const group of groups) { |
| 263 | if (containsRect(this._bounding, group._bounding)) |
| 264 | children.add(group) |
| 265 | } |
| 266 | |
| 267 | groups.sort((a, b) => { |
| 268 | if (a === this) { |
| 269 | return children.has(b) ? -1 : 0 |
| 270 | } else if (b === this) { |
| 271 | return children.has(a) ? 1 : 0 |
| 272 | } else { |
| 273 | return 0 |
| 274 | } |
| 275 | }) |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * Resizes and moves the group to neatly fit all given {@link objects}. |
no test coverage detected