Skip to main content
It does the maths only. Your tool converts the pointer position and draws the indicator.

Import

Example

Notes

  • Give the points, the grid spacing and the radius in the same unit. Paper tools use millimetres.
  • snap() tries the nearest target first, then the grid. If it finds none, it returns your point with snapped: false.
  • snapToTargets() does not use the grid.
  • Convert screen pixels to your unit before the call.

Constructor

Methods

snap

Snap a point.

snapToTargets

Endpoint-only snap (NO grid): the nearest target within snapRadius, else the point unchanged.

setGridSpacing

setSnapRadius

Set the snap radius (paper mm).

drawingSnapTargets

Snap candidates from a drawing’s primitives: line ends, arc centres, region corners, and optionally segment midpoints.

Types

SnapResult

SnapTargetOptions

The points in a drawing that a snap can lock onto — the geometry a dimension or a dragged vertex should land exactly on.
boolean
Include the midpoint of every segment as well as its ends.
string
Skip primitives belonging to this element — a vertex must not snap to the very geometry it is dragging.
Last modified on October 6, 2026