@mocanvas/editor · function
declare function maybeSnapToGrid(point: VecLike, editor: Editor): VecSnap a page-space point to the grid, when grid mode is on.
Returns the point unchanged when it is off, so a call site can use it unconditionally rather than branching — which is the point: every shape creation path was independently forgetting to snap, and only some of them.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.