Add separate undo/redo history for mask and layers

Refactors CanvasState to maintain independent undo/redo stacks for mask editing and layer editing. Updates all relevant logic to use the correct history depending on the active mode, ensuring undo/redo and history buttons work as expected in both modes. MaskTool now saves history on activation, clear, and mouse up, and history info is reported per mode. Improves user experience when switching between mask and layer editing.
This commit is contained in:
Dariusz L
2025-06-26 03:22:18 +02:00
parent 63ab402154
commit cb142908ad
5 changed files with 192 additions and 35 deletions

View File

@@ -156,7 +156,7 @@ export class CanvasInteractions {
return;
}
this.canvas.maskTool.handleMouseUp();
this.canvas.saveState();
// Nie wywołujemy saveState - to już jest obsługiwane w MaskTool
this.canvas.render();
return;
}
@@ -266,7 +266,11 @@ export class CanvasInteractions {
this.canvas.viewport.y = worldCoords.y - (mouseBufferY / this.canvas.viewport.zoom);
}
this.canvas.render();
this.canvas.saveState(true);
// Nie zapisujemy stanu podczas scrollowania w trybie maski
if (!this.canvas.maskTool.isActive) {
this.canvas.saveState(true);
}
}
handleKeyDown(e) {