fix: transform tools — move/copy press-drag-release, correct coordinate calculation
This commit is contained in:
@@ -368,6 +368,18 @@ export class InteractionEngine {
|
|||||||
return;
|
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.state.activeTool === 'select' && this.selectionEngine.isBoxSelecting()) {
|
||||||
if (this.selectionEngine.hasBoxMoved()) {
|
if (this.selectionEngine.hasBoxMoved()) {
|
||||||
this.selectionEngine.finishBoxSelect(this.allElements);
|
this.selectionEngine.finishBoxSelect(this.allElements);
|
||||||
@@ -765,8 +777,26 @@ export class InteractionEngine {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move/Copy/Rotate/Scale/Mirror: require existing selection
|
// Move/Copy: press-drag-release (kein click-click)
|
||||||
// Second click confirms the modification
|
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) {
|
if (this.state.phase === 'modifying' && this.state.points.length >= 1) {
|
||||||
this.confirmModify(pt);
|
this.confirmModify(pt);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user