From 137f5f3a277c4308779fb5bfdd10337d83d266ca Mon Sep 17 00:00:00 2001 From: A0 Orchestrator Date: Thu, 2 Jul 2026 05:24:15 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20transform=20tools=20=E2=80=94=20move/cop?= =?UTF-8?q?y=20press-drag-release,=20correct=20coordinate=20calculation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/interaction/index.ts | 34 +++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/frontend/src/interaction/index.ts b/frontend/src/interaction/index.ts index b0c017e..0e029ca 100644 --- a/frontend/src/interaction/index.ts +++ b/frontend/src/interaction/index.ts @@ -368,6 +368,18 @@ export class InteractionEngine { return; } + // Move/Copy: confirm on mouseUp (drag-release) + if (this.state.phase === 'modifying' && this.state.points.length >= 1) { + const tool = this.state.activeTool; + if (tool === 'move' || tool === 'copy') { + const raw = this.getWorldCoords(e); + const snapped = this.applySnap(raw.x, raw.y); + const final = this.applyOrtho(snapped.x, snapped.y); + this.confirmModify(final); + return; + } + } + if (this.state.activeTool === 'select' && this.selectionEngine.isBoxSelecting()) { if (this.selectionEngine.hasBoxMoved()) { this.selectionEngine.finishBoxSelect(this.allElements); @@ -765,8 +777,26 @@ export class InteractionEngine { return; } - // Move/Copy/Rotate/Scale/Mirror: require existing selection - // Second click confirms the modification + // Move/Copy: press-drag-release (kein click-click) + if (tool === 'move' || tool === 'copy') { + if (this.state.phase === 'modifying' && this.state.points.length >= 1) { + // Zweiter Klick bei move/copy — sollte nicht passieren, aber falls doch: bestätigen + this.confirmModify(pt); + return; + } + const selected = this.selectionEngine.getSelectedElements(this.allElements); + if (selected.length === 0) { + this.onCommandTrigger?.('select-first'); + return; + } + this.modifySelected = selected; + this.state.phase = 'modifying'; + this.state.points.push(pt); // Start-Punkt für drag + this.notifyToolStateChanged(); + return; + } + + // Rotate/Scale/Mirror: click-click (Pivot + Target) if (this.state.phase === 'modifying' && this.state.points.length >= 1) { this.confirmModify(pt); return;