From 6447ca3c0476c64aa80764e56d9e8d8c36250978 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:49:56 +0200 Subject: [PATCH] make sure the button in mousedown is leftclick lol --- src/components/Gallery.astro | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/Gallery.astro b/src/components/Gallery.astro index 4684030..ed37b0a 100644 --- a/src/components/Gallery.astro +++ b/src/components/Gallery.astro @@ -66,6 +66,11 @@ const imgCount = gallery.match(/<\s*img/gs)?.length; // Navigating by swiping / clicking on the sides gallery.querySelector('main')!.addEventListener('mousedown', e => { const touchPos = e.clientX; + + // Make sure it's left click lol + if (e.button != 0) { + return; + } // Remove any existing touch-start attribute gallery.removeAttribute('touch-start'); @@ -85,6 +90,10 @@ const imgCount = gallery.match(/<\s*img/gs)?.length; } }); gallery.querySelector('main')!.addEventListener('mousemove', e => { + // Make sure it's left click lol + if (e.button != 0) { + return; + } const start = gallery.getAttribute('touch-start'); if (start) { const startPos = parseInt(start);