aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-18 06:19:39 -0700
committerAdam Soltys <[email protected]>2026-10-18 06:19:39 -0700
commit7859a2fb3937f44727c9a3408d407da926b4f724 (patch)
tree2f54e0c4aa991187ca91642b06e1752a5944540b /src
parent78fbd1fb0be6c7029409c8ab5cb020009853c4c5 (diff)
downloadcoinosv3-7859a2fb3937f44727c9a3408d407da926b4f724.tar.gz
coinosv3-7859a2fb3937f44727c9a3408d407da926b4f724.zip
The media pager no longer goes round from its last post to its first (or first to last): a step, a flick or the wheel at an end stays there.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013ZDf1cyCQLkfjftYhymZAg
Diffstat (limited to 'src')
-rw-r--r--src/features/messages.js39
1 files changed, 9 insertions, 30 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 66bee68..0c69f23 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -13217,12 +13217,9 @@ export function messagesFeature(ctx) {
if (v) {
const groups = pagerGroups();
const from = here && here.closest('.mp-group');
- const index = groups.indexOf(from) + v;
- const to = groups[(index + groups.length) % groups.length];
- if (to) {
- if (index < 0 || index >= groups.length) pagerWrap(to);
- else pagerGlide(pager.scroller, 'y', pagerAt(pager.scroller, to, true));
- }
+ // the ends are ends: no going round to the other (Adam, 2026-10-18)
+ const to = groups[groups.indexOf(from) + v];
+ if (to) pagerGlide(pager.scroller, 'y', pagerAt(pager.scroller, to, true));
return !!to;
}
if (hz) {
@@ -13264,10 +13261,10 @@ export function messagesFeature(ctx) {
const here = pagerHere();
from = here && here.closest('.mp-group');
}
- const next = stops.indexOf(from) + dir * (n <= 2 || !pagerCanFly() ? 1 : 2);
- const i = (next % stops.length + stops.length) % stops.length;
- if (next < 0 || next >= stops.length) { fly = null; pagerWrap(stops[i]); return; }
+ // a flight stops at the end it reaches
+ const i = Math.min(stops.length - 1, Math.max(0, stops.indexOf(from) + dir * (n <= 2 || !pagerCanFly() ? 1 : 2)));
const to = stops[i];
+ if (to === from && !live) return;
fly = { to, n, at: now, dir };
if (live) pager.scroller._onDone = null; // the flight goes on: not a landing
pagerFlyTo(to);
@@ -13310,17 +13307,6 @@ export function messagesFeature(ctx) {
pager.el.classList.toggle('has-right', !!slide.nextElementSibling);
}
- // Crossing the boundary jumps directly to the other end, without flying
- // backwards through every loaded post or waiting for a network request.
- function pagerWrap(group) {
- if (!pager || !group) return;
- pager.scroller._onDone = null;
- pagerHold(pager.scroller);
- pager.scroller.style.scrollSnapType = '';
- pager.flying = false;
- const slide = rowSlide(group);
- if (slide) { pagerShow(slide); pagerArrive(slide); }
- }
// Counted: the posts in the carousel — the ones that can be reached. (All
// the posts found, the waiting ones too, was tried and undone: a count
// that can't be scrolled to confused — Adam, 2026-10-17.)
@@ -13477,17 +13463,10 @@ export function messagesFeature(ctx) {
// the stop it set off from, then one along (or back) — or, flung, several
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 && pagerCanFly() && !(d.caught && step !== d.caught) ? Math.min(FLY_MAX, Math.max(1, Math.round(Math.abs(vel) * FLY_TAU / Math.max(1, box.clientHeight)))) : 1;
+ // past either end, it stops at the end: going round to the other end
+ // was tried and undone (Adam, 2026-10-18: "let's not make the media
+ // pager circle around to the start anymore")
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; }