Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO: Undo Doesn't Work for Polygon Tool #3741

Open
brishtibheja opened this issue Jan 18, 2025 · 1 comment · May be fixed by #3759
Open

IO: Undo Doesn't Work for Polygon Tool #3741

brishtibheja opened this issue Jan 18, 2025 · 1 comment · May be fixed by #3759

Comments

@brishtibheja
Copy link
Contributor

Steps

  1. Create a rectangular mask.
  2. Use the polygon tool to put some points on the image.
  3. Use undo from toolbar.

Behaviour

Using undo removes the rectangular mask. I expected it to simply remove the unfinished polygon from my image.

@abdnh
Copy link
Collaborator

abdnh commented Jan 20, 2025

If anyone is interested in looking into this, this makes the undo system recognize each line as an undoable shape, but probably more changes are required:

diff --git a/ts/routes/image-occlusion/tools/tool-undo-redo.ts b/ts/routes/image-occlusion/tools/tool-undo-redo.ts
index c1754376e..455709ed0 100644
--- a/ts/routes/image-occlusion/tools/tool-undo-redo.ts
+++ b/ts/routes/image-occlusion/tools/tool-undo-redo.ts
@@ -20,7 +20,7 @@ type UndoState = {
     redoable: boolean;
 };

-const shapeType = ["rect", "ellipse", "i-text", "group"];
+const shapeType = ["rect", "ellipse", "i-text", "group", "line", "polygon"];

 const validShape = (shape: fabric.Object): boolean => {
     if (shape.width! <= 5 || shape.height! <= 5) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants