From 887ad2e39f5c68573605cadb5b5fae9865cf1d2c Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Mon, 9 Jun 2025 00:33:39 +0800 Subject: [PATCH] Fix group rotation (#1058) * Update history.js - Change `BatchCommand.unapply` to use `[...this.commands].reverse()` so the original array is never mutated. - This preserves the order of commands and ensures history integrity. --- packages/svgcanvas/core/history.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/svgcanvas/core/history.js b/packages/svgcanvas/core/history.js index 891f4e8b..71bcf127 100644 --- a/packages/svgcanvas/core/history.js +++ b/packages/svgcanvas/core/history.js @@ -425,7 +425,7 @@ export class BatchCommand extends Command { */ unapply (handler) { super.unapply(handler, () => { - this.stack.reverse().forEach((stackItem) => { + [...this.stack].reverse().forEach((stackItem) => { console.assert(stackItem, 'stack item should not be null') stackItem && stackItem.unapply(handler) })