From 14e401c9fac406096d05b6986d466df2f6494401 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 5 Apr 2026 04:36:33 +0200 Subject: [PATCH] Enhance selection duplication handling in App.js --- src/app/App.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/App.js b/src/app/App.js index b99878a4..29266fb8 100644 --- a/src/app/App.js +++ b/src/app/App.js @@ -2129,11 +2129,28 @@ export function App({ store, initialStatusMessage }) { } try { store.executeCommand(createDuplicateSelectionCommand()); - const duplicatedSelection = store.getState().selection; + const duplicatedState = store.getState(); + const duplicatedSelection = duplicatedState.selection; const canGrabDuplicatedSelection = (duplicatedSelection.kind === "brushes" || duplicatedSelection.kind === "entities" || duplicatedSelection.kind === "modelInstances") && duplicatedSelection.ids.length === 1; if (canGrabDuplicatedSelection) { - beginTransformOperation("translate", "keyboard"); + const transformSourcePanelId = layoutMode === "quad" ? hoveredViewportPanelId ?? activePanelId : activePanelId; + const transformTargetResult = resolveTransformTarget(duplicatedState.document, duplicatedSelection, whiteboxSelectionMode); + const transformTarget = transformTargetResult.target; + if (transformTarget === null) { + setStatusMessage(transformTargetResult.message ?? "Duplicated selection, but could not start move transform."); + return true; + } + if (duplicatedState.activeViewportPanelId !== transformSourcePanelId) { + store.setActiveViewportPanel(transformSourcePanelId); + } + store.setTransformSession(createTransformSession({ + source: "keyboard", + sourcePanelId: transformSourcePanelId, + operation: "translate", + target: transformTarget + })); + setStatusMessage(`Move ${getTransformTargetLabel(transformTarget).toLowerCase()} in ${getViewportPanelLabel(transformSourcePanelId)}. Move the pointer, press X/Y/Z to constrain, click or press Enter to commit, Escape cancels.`); } else { setStatusMessage("Duplicated selection.");