@mocanvas/mocanvas · function
declare function fitFrameToContent(editor: Editor, id: ShapeId, opts?: {
padding?: number;
}): voidResize a frame — or any frame-like container — so it fits its children,
with padding around them.
The frame's children keep their page positions: the frame moves and resizes around them rather than the other way round, so fitting a frame never disturbs the drawing inside it. A frame with no children is left alone, because shrinking it to nothing would make it unclickable.
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.