@mocanvas/editor · function
declare function findShapeAncestor(editor: Editor, shape: ShapeRef | undefined, predicate: (parent: UnknownShape) => boolean): UnknownShape | undefinedThe nearest ancestor of shape that predicate accepts, or undefined.
Searches upwards from the shape's parent, so a shape is never its own ancestor. This is how a tool finds "the frame I am inside" or "the outermost group holding me" without writing the walk again.
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.