From 7a175a97e8e9ca48dc2731d00fecaed1588ca806 Mon Sep 17 00:00:00 2001 From: Builder Date: Tue, 12 May 2026 16:38:02 -0400 Subject: [PATCH] Add swipe gesture to cycle specs on mobile Co-authored-by: Cursor --- js/app.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/js/app.js b/js/app.js index b40b9d8..257ab88 100644 --- a/js/app.js +++ b/js/app.js @@ -1085,6 +1085,25 @@ // and --headed; opens on click, closes on outside-click + Escape. initOverflowMenu(); + // Swipe left/right on main pane to cycle specs (mobile) + (function initSwipeSpecs(){ + const main = $('.main'); + if (!main) return; + let startX = 0, startY = 0; + main.addEventListener('touchstart', e => { + startX = e.touches[0].clientX; + startY = e.touches[0].clientY; + }, { passive: true }); + main.addEventListener('touchend', e => { + const dx = e.changedTouches[0].clientX - startX; + const dy = e.changedTouches[0].clientY - startY; + if (Math.abs(dx) < 60 || Math.abs(dy) > Math.abs(dx) * 0.6) return; + const idx = specs.findIndex(s => s.id === activeSpec); + if (dx < 0 && idx < specs.length - 1) activateSpec(specs[idx + 1].id); + else if (dx > 0 && idx > 0) activateSpec(specs[idx - 1].id); + }, { passive: true }); + })(); + // Friendly nudge: animate the Run All button briefly on first load setTimeout(()=> $('#run-all').classList.add('pulse'), 600);