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;