fix(editor): Fix sticky duplication and position bug (#3755)

* fix bug when inserting sticky

* center sticky on insert

* export as const
This commit is contained in:
Mutasem Aldmour
2022-07-26 12:41:34 +02:00
committed by GitHub
parent 1a7318b4cf
commit 92614c81ab
3 changed files with 26 additions and 2 deletions

View File

@@ -474,6 +474,10 @@ export const getRelativePosition = (x: number, y: number, scale: number, offset:
];
};
export const getMidCanvasPosition = (scale: number, offset: XYPosition): XYPosition => {
return getRelativePosition((window.innerWidth - SIDEBAR_WIDTH) / 2, (window.innerHeight - HEADER_HEIGHT) / 2, scale, offset);
};
export const getBackgroundStyles = (scale: number, offsetPosition: XYPosition) => {
const squareSize = GRID_SIZE * scale;
const dotSize = 1 * scale;