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 withsnapped: false.snapToTargets()does not use the grid.- Convert screen pixels to your unit before the call.
Constructor
Methods
snap
snapToTargets
snapRadius, else the point unchanged.
setGridSpacing
setSnapRadius
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.