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) <noreply@anthropic.com>
This commit is contained in:
igurielidze 2026-03-21 19:12:33 +04:00
parent 4f1d680406
commit 224aad4408

View File

@ -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);