From 0581d49eccced08496cd8bc47bfc459424c71c7d Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 5 Apr 2026 04:33:28 +0200 Subject: [PATCH] Enhance selection duplication logic and update tests --- src/app/App.js | 10 +++++++++- tests/e2e/box-brush-authoring.e2e.ts | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/App.js b/src/app/App.js index 8716c4ed..b99878a4 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -2129,7 +2129,15 @@ export function App({ store, initialStatusMessage }) { } try { store.executeCommand(createDuplicateSelectionCommand()); - setStatusMessage("Duplicated selection."); + const duplicatedSelection = store.getState().selection; + const canGrabDuplicatedSelection = (duplicatedSelection.kind === "brushes" || duplicatedSelection.kind === "entities" || duplicatedSelection.kind === "modelInstances") && + duplicatedSelection.ids.length === 1; + if (canGrabDuplicatedSelection) { + beginTransformOperation("translate", "keyboard"); + } + else { + setStatusMessage("Duplicated selection."); + } return true; } catch (error) { diff --git a/tests/e2e/box-brush-authoring.e2e.ts b/tests/e2e/box-brush-authoring.e2e.ts index 80166f75..879b3776 100644 --- a/tests/e2e/box-brush-authoring.e2e.ts +++ b/tests/e2e/box-brush-authoring.e2e.ts @@ -142,6 +142,10 @@ test("shift+d duplicates the current selection and does not trigger while typing kind: "brushes" }); expect(Object.keys(afterDuplicateSnapshot.document.brushes)).toHaveLength(2); + expect(afterDuplicateSnapshot.viewportTransientState.transformSession).toMatchObject({ + kind: "active", + operation: "translate" + }); const duplicatedBrushId = afterDuplicateSnapshot.selection.ids?.[0]; expect(duplicatedBrushId).toBeDefined();