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
This commit is contained in:
Hikaru Y 2023-10-25 08:02:44 +09:00 committed by GitHub
parent 0736cdb29c
commit 252addf611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -120,6 +120,7 @@ const pasteItem = (canvas: fabric.Canvas): void => {
top: clonedObj.top + 10, top: clonedObj.top + 10,
evented: true, evented: true,
}); });
disableRotation(clonedObj);
if (clonedObj.type === "activeSelection") { if (clonedObj.type === "activeSelection") {
// active selection needs a reference to the canvas. // active selection needs a reference to the canvas.

View File

@ -98,6 +98,7 @@ export const drawEllipse = (canvas: fabric.Canvas): void => {
} }
if (ellipse.width < 5 || ellipse.height < 5) { if (ellipse.width < 5 || ellipse.height < 5) {
canvas.remove(ellipse); canvas.remove(ellipse);
ellipse = undefined;
return; return;
} }
@ -118,5 +119,6 @@ export const drawEllipse = (canvas: fabric.Canvas): void => {
ellipse.setCoords(); ellipse.setCoords();
canvas.setActiveObject(ellipse); canvas.setActiveObject(ellipse);
undoStack.onObjectAdded(ellipse.id); undoStack.onObjectAdded(ellipse.id);
ellipse = undefined;
}); });
}; };

View File

@ -93,6 +93,7 @@ export const drawRectangle = (canvas: fabric.Canvas): void => {
} }
if (rect.width < 5 || rect.height < 5) { if (rect.width < 5 || rect.height < 5) {
canvas.remove(rect); canvas.remove(rect);
rect = undefined;
return; return;
} }
@ -113,5 +114,6 @@ export const drawRectangle = (canvas: fabric.Canvas): void => {
rect.setCoords(); rect.setCoords();
canvas.setActiveObject(rect); canvas.setActiveObject(rect);
undoStack.onObjectAdded(rect.id); undoStack.onObjectAdded(rect.id);
rect = undefined;
}); });
}; };