This is just a simple demo of how you can keep a mouse/touch-controlled image snapped to a grid. Click the green flag and move your mouse/finger around. The red cursor will move smoothly with your mouse/finger. The blue cursor will stay as close as possible to the mouse/finger touch-point, but will be limited to staying at intersections in the dark grid. Notice how the position of the red cursor relative to the light grid corresponds to when the blue cursor snaps to a different dark grid point.