@mocanvas/editor · function

kickoutOccludedShapes

declare function kickoutOccludedShapes(editor: Editor, containerIds: readonly ShapeId[]): UnknownShape[]

Reparent to the page any shape that is no longer inside the container it claims to be in.

The situation this fixes: a frame is resized, or one of its children is moved by something other than a drag — an undo, an alignment, a peer's edit — and a child ends up visually outside its parent while still being clipped by it. The child becomes invisible and unselectable, which reads as data loss.

Pass the ids of the containers to check. Returns the shapes that were moved.

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.