enableSnap(snapX, snapY, onDrag, onRelease, snapOffsetX, snapOffsetY)
Make this Sprite snap to the given grid either during drag or when it's released.
For example 16x16 as the snapX and snapY would make the sprite snap to every 16 pixels.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
snapX | number | The width of the grid cell to snap to. | ||
snapY | number | The height of the grid cell to snap to. | ||
onDrag | boolean | <optional> | true | If true the sprite will snap to the grid while being dragged. |
onRelease | boolean | <optional> | false | If true the sprite will snap to the grid when released. |
snapOffsetX | number | <optional> | 0 | Used to offset the top-left starting point of the snap grid. |
snapOffsetY | number | <optional> | 0 | Used to offset the top-left starting point of the snap grid. |
- Source code: input/InputHandler.js (Line 1614)
Please login to continue.