Grid class
Class for a workspace's grid.
Signature:
export declare class Grid
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(pattern, options) | Constructs a new instance of the Grid class |
Methods
Method | Modifiers | Description |
---|---|---|
alignXY(xy) | Given a coordinate, return the nearest coordinate aligned to the grid. | |
getLength() | Get the length of the grid lines (in px). | |
getSpacing() | Get the spacing of the grid points (in px). | |
setLength(length) | Sets the length of the grid lines. | |
setSnapToGrid(snap) | Sets whether blocks should snap to the grid or not. Setting this to true does not trigger snapping. If you want to snap blocks to the grid programmatically that needs to be triggered on individual top-level blocks. The next time a block is dragged and dropped it will snap to the grid. |
|
setSpacing(spacing) | Sets the spacing between the centers of the grid lines. This does not trigger snapping to the newly spaced grid. If you want to snap blocks to the grid programmatically that needs to be triggered on individual top-level blocks. The next time a block is dragged and dropped it will snap to the grid if snapping to the grid is enabled. |
|
shouldSnap() | Whether blocks should snap to the grid. |