PromucFlow_constructor/app/client/src/utils/helpers.tsx

6 lines
218 B
TypeScript
Raw Normal View History

export const snapToGrid = (cellSize: number, x: number, y: number) => {
const snappedX = Math.floor(x / cellSize) * cellSize;
const snappedY = Math.floor(y / cellSize) * cellSize;
return [snappedX, snappedY];
};