+3
-4
@@ -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),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -62,12 +62,9 @@ export const pointToRendererPoint = (
|
||||
};
|
||||
|
||||
if (snapToGrid) {
|
||||
const transformedGridSizeX = snapX * tScale;
|
||||
const transformedGridSizeY = snapY * tScale;
|
||||
|
||||
return {
|
||||
x: transformedGridSizeX * Math.round(position.x / transformedGridSizeX),
|
||||
y: transformedGridSizeY * Math.round(position.y / transformedGridSizeY),
|
||||
x: snapX * Math.round(position.x / snapX),
|
||||
y: snapY * Math.round(position.y / snapY),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user