From dbb302f765ff48e4c10038af1fcc1c4e225a6d36 Mon Sep 17 00:00:00 2001 From: sjat Date: Mon, 8 Jun 2026 22:50:30 +0200 Subject: [PATCH] fix: guard alignment input against numeric-field editing and calibration clicks Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app/alignment-ui.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/alignment-ui.ts b/src/app/alignment-ui.ts index e891ce2..dd5d437 100644 --- a/src/app/alignment-ui.ts +++ b/src/app/alignment-ui.ts @@ -63,6 +63,8 @@ export function mountAlignment(deps: AlignmentDeps): void { overlay.addEventListener('mousedown', (ev) => { const H = deps.getHomography(); if (!H) return; + // Another module (e.g. calibration) has armed the overlay for this click; don't hijack it. + if (!armOrigin && overlay.classList.contains('interactive')) return; if (armOrigin) { const a = deps.getAlignment(); const m = imageToMachine(H, normFromEvent(overlay, ev)); @@ -98,11 +100,13 @@ export function mountAlignment(deps: AlignmentDeps): void { }); window.addEventListener('mouseup', () => { + if (!dragging) return; // only release the overlay if THIS module was dragging dragging = false; overlay.classList.remove('interactive'); }); window.addEventListener('keydown', (ev) => { + if (document.activeElement instanceof HTMLInputElement) return; const a = deps.getAlignment(); const step = 1; if (ev.key === 'ArrowLeft') a.tx -= step;