@mocanvas/mocanvas · function

createShapesForAssets

declare function createShapesForAssets(editor: Editor, assets: Asset[], position: VecLike): Promise<ShapeId[]>

Store assets and create the shape each one calls for, centred on position and stacked so several dropped files do not land exactly on top of one another.

Which shape an asset becomes is the asset util's answer, via editor.getShapeUtilForAssetType — so an app that registered a util for its own asset type gets its own shape here without changing this function.

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.