From 15fb49ea75203885c97c9b78b98bef74b24e630c Mon Sep 17 00:00:00 2001 From: moklick Date: Wed, 23 Oct 2019 13:59:56 +0200 Subject: [PATCH] fix(selection): work correctly when snapToGrid = true --- src/components/NodesSelection/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/NodesSelection/index.tsx b/src/components/NodesSelection/index.tsx index f40fb01b..059e1a27 100644 --- a/src/components/NodesSelection/index.tsx +++ b/src/components/NodesSelection/index.tsx @@ -29,10 +29,13 @@ export default memo(() => { transform: s.transform, selectedNodesBbox: s.selectedNodesBbox, selectedElements: s.selectedElements, + snapToGrid: s.snapToGrid, + snapGrid: s.snapGrid })); const updateNodePos = useStoreActions(a => a.updateNodePos); const [x, y, k] = state.transform; const position = state.selectedNodesBbox; + const grid = (state.snapToGrid ? state.snapGrid : [1, 1])! as [number, number]; const onStart = (evt: MouseEvent) => { const scaledClient: XYPosition = { @@ -84,6 +87,7 @@ export default memo(() => { > onStart(evt as MouseEvent)} onDrag={evt => onDrag(evt as MouseEvent)} >