Skip to main content

Home > @jsplumbtoolkit/core > Magnetizer > snapToGrid

Magnetizer.snapToGrid() method

Snaps all elements to a grid. Returns a map of element IDs, representing all the elements that were moved.

Signature:

snapToGrid(grid: Grid): Record<string, {
original: PointXY;
current: PointXY;
}>;

Parameters

ParameterTypeDescription
gridGrid

Returns:

Record<string, { original: PointXY; current: PointXY; }>