diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/features/messages.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 82b1986..326c420 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -13324,12 +13324,20 @@ export function messagesFeature(ctx) { const from = stops.reduce((bi, p, i) => (Math.abs(p - d.start) < Math.abs(stops[bi] - d.start) ? i : bi), 0); const posts = y && step && Math.abs(vel) >= FLY_V ? Math.min(FLY_MAX, Math.max(1, Math.round(Math.abs(vel) * FLY_TAU / Math.max(1, box.clientHeight)))) : 1; const next = from + step * posts; + // Past either end, round to the other: the first post (going up, the + // last) — a step, or a fling whose coast is mostly beyond the end. A + // fling from near the end used to stop on the last post, and there, + // where the clips still warming join one by one, each flick landed on + // the newest instead of getting round (Adam, 2026-10-17: "make it + // coast right around to the start again even if a video near the end + // is loading in"). A fling from further back, only its tail past the + // end, flies to the last post. + const left = step > 0 ? stops.length - 1 - from : from; // posts between here and the end it heads for + if (y && (next < 0 || next >= stops.length) && left * 2 < posts) { const g = pagerGroups(); pagerWrap(next < 0 ? g[g.length - 1] : g[0]); return; } if (y && posts > 1) { const i = Math.min(stops.length - 1, Math.max(0, next)); if (i !== from) { pagerFlyTo(pagerGroups()[i], { vel, pace: 260, most: 4000 }); return; } } - // past either end: round to the other (a fling at the end too — one post of wrap, not its whole count) - if (y && (next < 0 || next >= stops.length)) { pagerWrap(pagerGroups()[(from + step + stops.length) % stops.length]); return; } pagerGlide(box, d.axis, stops[Math.min(stops.length - 1, Math.max(0, next))], vel); } el.addEventListener('touchend', (e) => { |
