boxOfDefinition function
The local box of the definition definition in doc, from its live
leaves (the entities it owns); null when definition names no definition
or none of its leaves draws.
Not memoised: O(entities) per call. The per-document memo cleared on a
document change belongs to the caller (WallFaces, spec D3, D4).
Implementation
SymbolBox? boxOfDefinition(DraftDocument doc, Handle definition) {
if (doc.tree.definition(definition) == null) return null;
final entities = doc.entities;
return boxOfLeaves([
for (final slot in entities.liveSlots)
if (entities.ownerAt(slot) == definition)
(
entities.kindAt(slot),
doc.geometry.read(entities.geomIndexAt(slot)),
),
]);
}