From 2000b58add47763678fe99602e51b1ee0336bb27 Mon Sep 17 00:00:00 2001 From: moklick Date: Sun, 31 May 2020 12:09:21 +0200 Subject: [PATCH] fix(snaptogrid): don't scale grid size closes #261 --- src/store/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 18e99bab..8d39e839 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -195,12 +195,11 @@ const storeModel: StoreModel = { let position: XYPosition = pos; if (state.snapToGrid) { - const transformedGridSizeX = state.snapGrid[0] * state.transform[2]; - const transformedGridSizeY = state.snapGrid[1] * state.transform[2]; + const [gridSizeX, gridSizeY] = state.snapGrid; position = { - x: transformedGridSizeX * Math.round(pos.x / transformedGridSizeX), - y: transformedGridSizeY * Math.round(pos.y / transformedGridSizeY), + x: gridSizeX * Math.round(pos.x / gridSizeX), + y: gridSizeY * Math.round(pos.y / gridSizeY), }; }