@fogrexon/glyph-arena-scene
Hierarchical scene graph nodes. See also package README.
Exports
Generated from the package's source when the docs are built — do not edit this table by hand.
| Name | Kind |
|---|---|
Forest | type |
Node | type |
createForest | function |
createForest()
const forest = createForest();
const root = forest.create();
const child = forest.create();
forest.setParent(child, root);
forest.parent(child);
forest.children(root);
forest.destroy(child);
forest.dispose();
Methods
create()— create a root node withparentnull. Returns an opaqueNode.destroy(node)— destroynodeand its entire subtree. Removes the node from its parent's children.setParent(child, parent | null)— movechildunderparent, or re-root whenparentisnull.parent(node)— return the parentNode, ornullfor roots and invalid nodes.children(node)— return a readonly copy of direct child nodes.dispose()— invalidate every node in this forest. After dispose, all nodes behave as missing.
Node
Opaque node handle. Nodes from another forest are invalid in this forest.
Parenting
setParentis a move: remove from the old parent's children, append to the new parent's end.- Re-parenting within the same parent moves the child to the end.
- Cyclic
setParentis a no-op, includingsetParent(node, node). setParent(child, missingParent)is a no-op; onlynullre-roots.
Invalid nodes
Missing nodes, nodes from another forest, destroyed nodes, and nodes after dispose are invalid:
parentreturnsnullchildrenreturns[]destroy,setParentare no-ops
After dispose, create() returns nodes that behave as missing.
ID reuse
Destroyed node ids may be reused by later create() calls.