@mocanvas/editor · function

resizeToBounds

declare function resizeToBounds(editor: Editor, ids: readonly ShapeId[], bounds: BoxLike): void

Scale and move shapes so their common bounds become bounds exactly.

The primitive behind "fit this frame's contents" and behind importing a drawing at a known size. The whole set is treated as one rigid group — every shape gets the same scale factor — so relative positions and sizes survive.

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.