Merge pull request #263 from wbkd/develop

Develop
This commit is contained in:
Moritz
2020-05-31 12:17:10 +02:00
committed by GitHub
2 changed files with 5 additions and 9 deletions
+3 -4
View File
@@ -195,12 +195,11 @@ const storeModel: StoreModel = {
let position: XYPosition = pos; let position: XYPosition = pos;
if (state.snapToGrid) { if (state.snapToGrid) {
const transformedGridSizeX = state.snapGrid[0] * state.transform[2]; const [gridSizeX, gridSizeY] = state.snapGrid;
const transformedGridSizeY = state.snapGrid[1] * state.transform[2];
position = { position = {
x: transformedGridSizeX * Math.round(pos.x / transformedGridSizeX), x: gridSizeX * Math.round(pos.x / gridSizeX),
y: transformedGridSizeY * Math.round(pos.y / transformedGridSizeY), y: gridSizeY * Math.round(pos.y / gridSizeY),
}; };
} }
+2 -5
View File
@@ -62,12 +62,9 @@ export const pointToRendererPoint = (
}; };
if (snapToGrid) { if (snapToGrid) {
const transformedGridSizeX = snapX * tScale;
const transformedGridSizeY = snapY * tScale;
return { return {
x: transformedGridSizeX * Math.round(position.x / transformedGridSizeX), x: snapX * Math.round(position.x / snapX),
y: transformedGridSizeY * Math.round(position.y / transformedGridSizeY), y: snapY * Math.round(position.y / snapY),
}; };
} }