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
| Parameter | Type | Description |
|---|---|---|
| grid | Grid |
Returns:
Record<string, { original: PointXY; current: PointXY; }>