diff --git a/frontend/src/routes/art/+page.svelte b/frontend/src/routes/art/+page.svelte index 54d150c..b6fe0d9 100644 --- a/frontend/src/routes/art/+page.svelte +++ b/frontend/src/routes/art/+page.svelte @@ -38,8 +38,8 @@ let zoomBoxEl, zoomImgEl; // refs for clamping pan to the image bounds let lastX = 0, lastY = 0, activePointer = null; - function enterZoom() { zoomLevel = 1.5; tx = 0; ty = 0; dragging = false; zoomed = true; } - function fit() { dragging = false; zoomed = false; } // back to the framed gallery view + function enterZoom() { zoomLevel = 1.5; tx = 0; ty = 0; dragging = false; activePointer = null; zoomed = true; } + function fit() { dragging = false; activePointer = null; zoomed = false; } // back to the framed gallery view function clampPan() { if (!zoomImgEl || !zoomBoxEl) return; const maxX = Math.max(0, (zoomImgEl.offsetWidth * zoomLevel - zoomBoxEl.clientWidth) / 2); @@ -55,12 +55,12 @@ clampPan(); } function dragStart(e) { - if (e.button !== 0) return; // primary button only + if (dragging || e.button !== 0) return; // primary button only; ignore a 2nd pointer mid-drag dragging = true; lastX = e.clientX; lastY = e.clientY; activePointer = e.pointerId; e.currentTarget.setPointerCapture?.(e.pointerId); } function dragMove(e) { - if (!dragging) return; + if (!dragging || e.pointerId !== activePointer) return; // only the pointer that started the drag tx += e.clientX - lastX; ty += e.clientY - lastY; lastX = e.clientX; lastY = e.clientY; clampPan(); @@ -76,7 +76,7 @@ function onKey(e) { if (e.key !== 'Escape') return; - if (zoomed) { zoomed = false; dragging = false; } // Escape steps out of inspection first, then closes + if (zoomed) { zoomed = false; dragging = false; activePointer = null; } // Escape steps out of inspection first, then closes else if (zoom) zoom = false; } // Leaving the lightbox always resets the inspector, so re-opening starts framed.