In experiment #119, I worked out resizing elements. The resize happens at a single pixel resolution. But often you want to resize based on a grid.
It turns out, all it takes is rounding to the nearest grid position:
const gridSize = 10 function snapToGrid(width) } return Math.round(width / gridSize) * gridSize }