Skip to content

Commit 4ef010a

Browse files
authored
Merge pull request #19 from iikuneva/fix/prevent-rotation-crash
Fix: prevent app crashes from rotation selection errors
2 parents 43cdc34 + a07b6ae commit 4ef010a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/utils/select/resizeHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ function startResizing(
2929
ctx.objectsMap
3030
);
3131
if (selectedObject.length !== 1) {
32-
throw new Error("start rotating got incorrect number of objects to handle");
32+
console.error("start rotating got incorrect number of objects to handle");
33+
return;
3334
}
3435
const data = selectedObject[0];
3536
// const pointDiff: Point = getPointDiff(relativePoint, prevPoint);

src/utils/select/rotateHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function startRotating(ctx: ReactDrawContext, relativePoint: Point) {
2121
ctx.objectsMap
2222
);
2323
if (selectedObject.length !== 1) {
24-
throw new Error("start rotating got incorrect number of objects to handle");
24+
console.error("start rotating got incorrect number of objects to handle");
25+
return;
2526
}
2627
const data = selectedObject[0];
2728
const referenceCenter = getCenterPoint(getBoxSize(data));

0 commit comments

Comments
 (0)