collectAllNodeIds function
Collect all node IDs from a document or a subtree root.
Implementation
Set<NodeId> collectAllNodeIds({CanvasSceneDocument? doc, Node? root}) {
assert((doc == null) != (root == null));
final roots = doc?.children ?? [root!];
final out = <NodeId>{};
void walk(Node n) {
out.add(n.id);
for (final c in n.childrenOrEmpty) {
walk(c);
}
}
for (final r in roots) {
walk(r);
}
return out;
}