aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-17 05:23:16 -0700
committerAdam Soltys <[email protected]>2026-10-17 05:23:16 -0700
commitc2005c74750d549f8983359fbed34df5c12360b3 (patch)
tree5260c7c9289df948952cb86dc99bdf05167ff9f4 /tools
parentd44a61a2b4e6b59ed6bebfe64d6b2f3a1dbb303d (diff)
downloadcoinosv3-c2005c74750d549f8983359fbed34df5c12360b3.tar.gz
coinosv3-c2005c74750d549f8983359fbed34df5c12360b3.zip
The pager's counter runs through the posts as a flight passes them, instead of jumping on landing.
Adam, 2026-10-17: "the counter should animate as we fly, right now the current position only updates when we land". While a flight is under way (a flung finger or a spin of the wheel), each scroll counts the post under the middle of the screen (a binary search over the posts' tops); the landing sets the post landed on, as before. tools/pager-swipe-fly-test.js: a flick from post 2 shows 2, 3, 4 … 9 on the way. pager-wheel, pager-ready-gate, profile-pager and thread-pager pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013ZDf1cyCQLkfjftYhymZAg
Diffstat (limited to 'tools')
-rw-r--r--tools/pager-swipe-fly-test.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/pager-swipe-fly-test.js b/tools/pager-swipe-fly-test.js
index cae3536..418b8e4 100644
--- a/tools/pager-swipe-fly-test.js
+++ b/tools/pager-swipe-fly-test.js
@@ -108,11 +108,13 @@ try {
console.log('\n[a fast flick: several posts, landing snapped]');
const trace = async (sw) => { await page.evaluate(() => { const sc = document.querySelector('.mp-scroll'); window.__tr = []; const t0 = performance.now(); const rec = () => { window.__tr.push(sc.scrollTop); if (performance.now() - t0 < 1500) requestAnimationFrame(rec); }; requestAnimationFrame(rec); }); await sw(); await sleep(1600); return page.evaluate(() => window.__tr); };
+ await page.evaluate(() => { const el = document.querySelector('.mp-position'); window.__counts = [el.textContent]; new MutationObserver(() => { if (window.__counts.at(-1) !== el.textContent) window.__counts.push(el.textContent); }).observe(el, { childList: true, characterData: true, subtree: true }); });
const tr = await trace(() => swipe(600, 80, 3)); await settled(); // three big moves: 3–6 px/ms as their handling takes, a long coast's worth (past the nine loaded, maybe)
const landed = await at();
check('a 600px flick in a few frames flies several posts on', landed !== 'between' && landed >= 5, String(landed));
check('…landing square on a post', landed !== 'between');
check('…in a glide, never back', tr.every((x, i) => !i || x >= tr[i - 1] - 0.5), tr.slice(0, 12).map((x) => Math.round(x)).join(' '));
+ check('the counter ran through the posts on the way, not jumping on landing', (await page.evaluate(() => window.__counts)).length >= 4, (await page.evaluate(() => window.__counts)).join(' → '));
const seen = await page.evaluate(() => document.querySelector('.mp-position').textContent);
check('the counter says where it landed', seen === landed + ' / ' + N, seen);