@mocanvas/mocanvas · function

onDragFromToolbarToCreateShape

declare function onDragFromToolbarToCreateShape(editor: Editor, _info: PointerEventInfo, opts: OnDragFromToolbarToCreateShapesOpts): void

Create a shape at the end of a drag that started on the toolbar.

The tool id stays masked for the length of the gesture so the toolbar keeps showing the button the drag came from rather than jumping to select the moment the shape exists. The mask is lifted on the next pointer-up — including a cancelled gesture, which still ends in one — so a released drag can never leave the toolbar stuck on a tool the editor is not in.

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.