Snap to grid
/* General idea:
x = floor(x / gridSize) * gridSize;
y = floor(y / gridSize) * gridSize;
floor() sets it to the beginning of the cell
round() to the tenth place multiplied by gridSize
ceil() to the end of the cell
*/
// example in typescript:
x = Math.round(x / gridSize) * gridSize;
y = Math.round(y / gridSize) * gridSize;
Zwazel