From 252addf611717c8b37c9034552c656da7cf03336 Mon Sep 17 00:00:00 2001 From: Hikaru Y Date: Wed, 25 Oct 2023 08:02:44 +0900 Subject: [PATCH] Fix shape selection malfunction after creating shapes in succession (#2773) * Fix shape selection malfunction after creating shapes in succession * Disable rotation when duplicating a shape --- ts/image-occlusion/tools/lib.ts | 1 + ts/image-occlusion/tools/tool-ellipse.ts | 2 ++ ts/image-occlusion/tools/tool-rect.ts | 2 ++ 3 files changed, 5 insertions(+) diff --git a/ts/image-occlusion/tools/lib.ts b/ts/image-occlusion/tools/lib.ts index ffb7b3d15..b8e663660 100644 --- a/ts/image-occlusion/tools/lib.ts +++ b/ts/image-occlusion/tools/lib.ts @@ -120,6 +120,7 @@ const pasteItem = (canvas: fabric.Canvas): void => { top: clonedObj.top + 10, evented: true, }); + disableRotation(clonedObj); if (clonedObj.type === "activeSelection") { // active selection needs a reference to the canvas. diff --git a/ts/image-occlusion/tools/tool-ellipse.ts b/ts/image-occlusion/tools/tool-ellipse.ts index b784a6999..66d10fa92 100644 --- a/ts/image-occlusion/tools/tool-ellipse.ts +++ b/ts/image-occlusion/tools/tool-ellipse.ts @@ -98,6 +98,7 @@ export const drawEllipse = (canvas: fabric.Canvas): void => { } if (ellipse.width < 5 || ellipse.height < 5) { canvas.remove(ellipse); + ellipse = undefined; return; } @@ -118,5 +119,6 @@ export const drawEllipse = (canvas: fabric.Canvas): void => { ellipse.setCoords(); canvas.setActiveObject(ellipse); undoStack.onObjectAdded(ellipse.id); + ellipse = undefined; }); }; diff --git a/ts/image-occlusion/tools/tool-rect.ts b/ts/image-occlusion/tools/tool-rect.ts index 6ad3f2d55..df957f7da 100644 --- a/ts/image-occlusion/tools/tool-rect.ts +++ b/ts/image-occlusion/tools/tool-rect.ts @@ -93,6 +93,7 @@ export const drawRectangle = (canvas: fabric.Canvas): void => { } if (rect.width < 5 || rect.height < 5) { canvas.remove(rect); + rect = undefined; return; } @@ -113,5 +114,6 @@ export const drawRectangle = (canvas: fabric.Canvas): void => { rect.setCoords(); canvas.setActiveObject(rect); undoStack.onObjectAdded(rect.id); + rect = undefined; }); };