MCPcopy Index your code
hub / github.com/simstudioai/sim / snapToGrid

Function snapToGrid

apps/sim/lib/workflows/autolayout/utils.ts:38–40  ·  view source on GitHub ↗

* Snaps a single coordinate value to the nearest grid position

(value: number, gridSize: number)

Source from the content-addressed store, hash-verified

36 * Snaps a single coordinate value to the nearest grid position
37 */
38function snapToGrid(value: number, gridSize: number): number {
39 return Math.round(value / gridSize) * gridSize
40}
41
42/**
43 * Snaps a position to the nearest grid point.

Callers 1

snapPositionToGridFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected