diff --git a/svelte-app/src/lib/canvas/interactions.ts b/svelte-app/src/lib/canvas/interactions.ts index c4559aa..70fe533 100644 --- a/svelte-app/src/lib/canvas/interactions.ts +++ b/svelte-app/src/lib/canvas/interactions.ts @@ -469,29 +469,9 @@ function onMousemove(e: MouseEvent) { localY = worldSnappedY - sym.y; } - // Constrain first/last waypoint to slide along their segment direction only - // (extend/shorten without rotating the end boxes) - if (wpIdx === 0 && wps.length >= 2) { - const next = wps[1]; - const dx = wps[0].x - next.x, dy = wps[0].y - next.y; - const len = Math.sqrt(dx * dx + dy * dy) || 1; - const ux = dx / len, uy = dy / len; - const dot = (localX - next.x) * ux + (localY - next.y) * uy; - localX = next.x + ux * dot; - localY = next.y + uy * dot; - } else if (wpIdx === wps.length - 1 && wps.length >= 2) { - const prev = wps[wps.length - 2]; - const dx = wps[wpIdx].x - prev.x, dy = wps[wpIdx].y - prev.y; - const len = Math.sqrt(dx * dx + dy * dy) || 1; - const ux = dx / len, uy = dy / len; - const dot = (localX - prev.x) * ux + (localY - prev.y) * uy; - localX = prev.x + ux * dot; - localY = prev.y + uy * dot; - } - wps[wpIdx] = { x: localX, y: localY }; - // Recalculate bounding box - recalcEpcBounds(sym); + // Defer recalcEpcBounds to mouseup — updating w/h mid-drag shifts + // the rotation center in toSymbolLocal, causing waypoints to jump. layout.markDirty(); } @@ -738,6 +718,8 @@ function onMouseup(e: MouseEvent) { } if (dragState.type === 'epc-waypoint' && dragState.dragActivated) { + const sym = layout.symbols.find(s => s.id === dragState!.placedId); + if (sym) recalcEpcBounds(sym); layout.markDirty(); layout.saveMcmState(); }