Skip to main content
Version: 4.3

SnaplinesProps

Props for the Snaplines component, controlling how and when elements snap to alignment guides while being dragged or resized.

The callback props (SnaplinesCanSnap, SnaplinesIsSnapTarget and SnaplinesAdditionalSnapPoints) receive React-style { id, model, paper, graph, ... } params instead of a raw dia.ElementView, matching the callback convention used across @joint/react and @joint/react-plus. Native options without a dedicated prop are reachable through the options escape hatch.

Properties

additionalSnapPoints?

readonly optional additionalSnapPoints?: (params) => PlainPoint[];

Provide extra snap points (beyond the element's bbox) for the current move/resize gesture.

Parameters

ParameterType
paramsSnaplinesAdditionalSnapPointsParams

Returns

PlainPoint[]


canSnap?

readonly optional canSnap?: (params) => boolean;

Predicate deciding whether the dragged element may snap: return true to allow snapping.

Parameters

ParameterType
paramsSnaplinesCanSnapParams

Returns

boolean


distance?

readonly optional distance?: number;

Snap radius in pixels: how close an edge must get before it snaps.

Default

10

isSnapTarget?

readonly optional isSnapTarget?: (params) => boolean;

Predicate deciding whether a candidate element may act as a snap target: return true to include it.

Parameters

ParameterType
paramsSnaplinesIsSnapTargetParams

Returns

boolean


options?

readonly optional options?: Partial<Options>;

Raw ui.Snaplines.Options passthrough for anything joint-react-plus doesn't expose as a dedicated prop (mvc internals like theme, events, attributes, tagName, etc.). Use this for the array forms of native filter (string[] of cell types / dia.Cell[] to exclude as snap targets); the dedicated isSnapTarget prop covers the predicate form.

Avoid overriding joint-react-plus-controlled options (paper).


usePaperGrid?

readonly optional usePaperGrid?: boolean;

Snap to the paper grid in addition to other elements.

Default

false