Skip to content

Commit d78fb6b

Browse files
committed
rounding fixed
1 parent 7204e16 commit d78fb6b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/DrawArea.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const DrawArea: FunctionComponent<IDrawArea> = ({
5454

5555
const newArea: IgnoreArea = {
5656
id: Date.now().toString(),
57-
x: (e.evt.layerX - stageOffset.x) / stageScale,
58-
y: (e.evt.layerY - stageOffset.y) / stageScale,
57+
x: Math.round((e.evt.layerX - stageOffset.x) / stageScale),
58+
y: Math.round((e.evt.layerY - stageOffset.y) / stageScale),
5959
width: MIN_RECT_SIDE_PIXEL,
6060
height: MIN_RECT_SIDE_PIXEL,
6161
};
@@ -82,8 +82,8 @@ const DrawArea: FunctionComponent<IDrawArea> = ({
8282
const newShapesList = ignoreAreas.map((i) => {
8383
if (i.id === selectedRectId) {
8484
// new width and height
85-
i.width = Math.max(mouseX - i.x, MIN_RECT_SIDE_PIXEL);
86-
i.height = Math.max(mouseY - i.y, MIN_RECT_SIDE_PIXEL);
85+
i.width = Math.max(Math.round(mouseX - i.x), MIN_RECT_SIDE_PIXEL);
86+
i.height = Math.max(Math.round(mouseY - i.y), MIN_RECT_SIDE_PIXEL);
8787
return i;
8888
}
8989
return i;

0 commit comments

Comments
 (0)