@mocanvas/editor · class

HandleSnaps

declare class HandleSnaps

Handle snapping: finding somewhere for a dragged endpoint to land.

Reached as editor.snaps.handles. Distinct from bounds snapping because the answer is a *point*, not an alignment: an arrow endpoint dropped near a rectangle should attach to the rectangle's outline, which has nothing to do with whether any edges line up.


Methods · 2

constructor(manager: SnapManager)
snapHandle({ currentShapeId, handle }: HandleSnapOptions): SnapData | null

Where a dragged handle should actually go, or null when nothing is close enough.

Discrete points win over outlines within the same threshold: a point is a deliberate target a shape offered, while an outline is a continuum, and landing exactly on a named point is almost always what was meant.


Properties · 2

readonly editor: Editor
readonly manager: SnapManager

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.