fix: guard alignment input against numeric-field editing and calibration clicks

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
sjat 2026-06-08 22:50:30 +02:00
parent 5d80273717
commit dbb302f765

View file

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