From 5550e929641b282a3de2c2cda66782d7c58689a1 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 13 Oct 2026 18:24:57 +0000 Subject: Pager: a snappy glide to the next slide, not the browser's slow smooth scroll Letting go of a swipe (or an arrow key) runs the pager's own eased-out glide, at most 220ms and quicker after a fast flick; a finger catching it mid-glide takes it from there. A swipe now lands in ~240ms (was ~425ms). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KPw21NEpWeTGu6swVASmBt --- tools/pager-tap-slop-test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tools') diff --git a/tools/pager-tap-slop-test.js b/tools/pager-tap-slop-test.js index c8d3609..b0bd339 100644 --- a/tools/pager-tap-slop-test.js +++ b/tools/pager-tap-slop-test.js @@ -123,6 +123,16 @@ try { await drag(195, 500, 0, -80, 2); s = await st(); check('a quick 80px flick up: the next post', s.on === was, JSON.stringify(s)); + + console.log('\n[snappy: let go, and it lands at once]'); + await drag(195, 500, 0, 300, 8); + await page.touchscreen.touchStart(195, 650); + for (let i = 1; i <= 8; i++) { await page.touchscreen.touchMove(195, 650 - 40 * i); await sleep(16); } + // from the finger lifting to the next slide resting square on the screen + await page.evaluate(() => { window.__landed = new Promise((res) => { const t0 = performance.now(); const look = () => { const s = [...document.querySelectorAll('.mp-slide')].find((x) => { const r = x.getBoundingClientRect(); return Math.abs(r.top) < 1 && Math.abs(r.left) < 1; }); if (s && !s.getAttribute('data-k').endsWith('/tall.webm')) res(Math.round(performance.now() - t0)); else if (performance.now() - t0 > 2000) res(-1); else requestAnimationFrame(look); }; requestAnimationFrame(look); }); }); + await page.touchscreen.touchEnd(); + const ms = await page.evaluate(() => window.__landed); + check('a swipe lands on the next post within 300ms', ms > 0 && ms <= 300, ms + 'ms'); check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | ')); } finally { await browser.close(); server.stop(true); } console.log(ok ? '\n✅ a little movement is still a tap' : '\n❌ failed'); -- cgit v1.2.3