From 224aad4408bf85431d1d72da95561677c59e39b7 Mon Sep 17 00:00:00 2001 From: igurielidze Date: Sat, 21 Mar 2026 19:12:33 +0400 Subject: [PATCH] Fix reversed resize direction on mirrored symbols When a symbol is mirrored, negate the horizontal drag delta and swap the left/right handle identity so resizing matches the visual direction. Also fixes spur handle resize with mirrored spurs. Co-Authored-By: Claude Opus 4.6 (1M context) --- svelte-app/src/lib/canvas/interactions.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/svelte-app/src/lib/canvas/interactions.ts b/svelte-app/src/lib/canvas/interactions.ts index e24fb5a..a926ba5 100644 --- a/svelte-app/src/lib/canvas/interactions.ts +++ b/svelte-app/src/lib/canvas/interactions.ts @@ -552,8 +552,9 @@ function onMousemove(e: MouseEvent) { const sym = layout.symbols.find(s => s.id === dragState!.placedId); if (!sym) return; const pos = screenToCanvas(e.clientX, e.clientY); - const dx = pos.x - dragState.startX!; + let dx = pos.x - dragState.startX!; const dy = pos.y - dragState.startY!; + if (sym.mirrored) dx = -dx; resizeSpur(sym, dx, dy, dragState.type === 'resize-spur-top', e.ctrlKey); layout.markDirty(); } @@ -562,9 +563,14 @@ function onMousemove(e: MouseEvent) { const sym = layout.symbols.find(s => s.id === dragState!.placedId); if (!sym) return; const pos = screenToCanvas(e.clientX, e.clientY); - const dx = pos.x - dragState.startX!; + let dx = pos.x - dragState.startX!; const dy = pos.y - dragState.startY!; - const isRight = dragState.type === 'resize-right'; + let isRight = dragState.type === 'resize-right'; + // When mirrored, swap handle direction and invert horizontal delta + if (sym.mirrored) { + dx = -dx; + isRight = !isRight; + } if (isCurvedType(sym.symbolId)) { resizeCurved(sym, dx, dy, isRight, e.ctrlKey);