@mocanvas/editor · function

visitDescendants

declare function visitDescendants(editor: Editor, parent: PageId | ShapeId, visitor: (id: ShapeId) => void | false): void

Call visitor for every descendant of parent, depth first, in draw order.

Returning false from the visitor prunes that branch — its children are not visited — which is what makes this usable for "collect until you reach a frame" walks rather than only for full traversals.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.