diff --git a/ts/image-occlusion/shapes/to-cloze.ts b/ts/image-occlusion/shapes/to-cloze.ts index c439c0887..bd7666bb8 100644 --- a/ts/image-occlusion/shapes/to-cloze.ts +++ b/ts/image-occlusion/shapes/to-cloze.ts @@ -36,6 +36,10 @@ export function exportShapesToClozeDeletions(occludeInactive: boolean): { */ function baseShapesFromFabric(occludeInactive: boolean): ShapeOrShapes[] { const canvas = globalThis.canvas as Canvas; + + // Prevents multiple shapes in 'activeSelection' from shifting to the canvas origin + canvas.discardActiveObject(); + makeMaskTransparent(canvas, false); const objects = canvas.getObjects() as FabricObject[]; return objects diff --git a/ts/image-occlusion/tools/tool-ellipse.ts b/ts/image-occlusion/tools/tool-ellipse.ts index 0edd3634a..a06ccbfc7 100644 --- a/ts/image-occlusion/tools/tool-ellipse.ts +++ b/ts/image-occlusion/tools/tool-ellipse.ts @@ -115,6 +115,7 @@ export const drawEllipse = (canvas: fabric.Canvas): void => { } ellipse.setCoords(); + canvas.setActiveObject(ellipse); undoStack.onObjectAdded(ellipse.id); }); }; diff --git a/ts/image-occlusion/tools/tool-polygon.ts b/ts/image-occlusion/tools/tool-polygon.ts index a57894f11..2ea662348 100644 --- a/ts/image-occlusion/tools/tool-polygon.ts +++ b/ts/image-occlusion/tools/tool-polygon.ts @@ -189,6 +189,7 @@ const generatePolygon = (canvas: fabric.Canvas, pointsList): void => { if (polygon.width > 5 && polygon.height > 5) { disableRotation(polygon); canvas.add(polygon); + canvas.setActiveObject(polygon); // view undo redo tools undoStack.onObjectAdded(polygon.id); emitChangeSignal(); diff --git a/ts/image-occlusion/tools/tool-rect.ts b/ts/image-occlusion/tools/tool-rect.ts index b3ccc85b3..c1bbb304a 100644 --- a/ts/image-occlusion/tools/tool-rect.ts +++ b/ts/image-occlusion/tools/tool-rect.ts @@ -109,6 +109,7 @@ export const drawRectangle = (canvas: fabric.Canvas): void => { } rect.setCoords(); + canvas.setActiveObject(rect); undoStack.onObjectAdded(rect.id); }); }; diff --git a/ts/image-occlusion/tools/tool-text.ts b/ts/image-occlusion/tools/tool-text.ts index f81815c52..46ff8cf3f 100644 --- a/ts/image-occlusion/tools/tool-text.ts +++ b/ts/image-occlusion/tools/tool-text.ts @@ -38,6 +38,7 @@ export const drawText = (canvas: fabric.Canvas): void => { disableRotation(text); enableUniformScaling(canvas, text); canvas.add(text); + canvas.setActiveObject(text); undoStack.onObjectAdded(text.id); }); };