Page fixes: v1.10.7 to v1.10.10 #21

Merged
ngu-git-admin merged 17 commits from page-fixes into main 2026-10-01 10:53:41 +01:00
Showing only changes of commit 5e77da9a66 - Show all commits

View file

@ -124,6 +124,9 @@ const STUCK_TOP = 16;
const stickAt = (listTop: number) => `calc(var(--header-h, 5rem) + ${STUCK_TOP - listTop}px)`; const stickAt = (listTop: number) => `calc(var(--header-h, 5rem) + ${STUCK_TOP - listTop}px)`;
const LIST_LEFT = 16; const LIST_LEFT = 16;
const CIRCLE_GAP = 8 + 4; const CIRCLE_GAP = 8 + 4;
/* How far off the screen's left edge the stuck circle's center may
go to take in a long list on a narrow window. */
const MAX_BACK = 1200;
/* The circle's color family for a section's accent (PageShell.css): /* The circle's color family for a section's accent (PageShell.css):
green and amber their own, teal and deep teal (and any other) teal. */ green and amber their own, teal and deep teal (and any other) teal. */
@ -198,15 +201,37 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
// the corner, centered on the header's bottom left so the header // the corner, centered on the header's bottom left so the header
// and the screen's edge hide three quarters of it, big enough to // and the screen's edge hide three quarters of it, big enough to
// reach past the list's far corner, but never wider than the column // reach past the list's far corner, but never wider than the column
// (it'd show a cut edge at the content). // (it'd show a cut edge at the content). When a narrow window holds
// it smaller than that, it moves to take the whole list in anyway:
// first its center down the screen's edge, then (if that isn't
// enough) off the screen to the left, growing by as much, so its
// right edge stays put while its arc flattens over the list.
const circleBox = (() => { const circleBox = (() => {
if (!listBox || !circle) return null; if (!listBox || !circle) return null;
if (stuck) { if (stuck) {
const radius = Math.min( const edge = columnWidth - 8; // the furthest right it may reach
Math.hypot(LIST_LEFT + listBox.width + 24, STUCK_TOP + listBox.height + 24), const roomy = Math.hypot(LIST_LEFT + listBox.width + 24, STUCK_TOP + listBox.height + 24);
columnWidth - 8, if (roomy <= edge) return { size: roomy * 2, left: -roomy, top: listTop - STUCK_TOP - roomy };
);
return { size: radius * 2, left: -radius, top: listTop - STUCK_TOP - radius }; // From the header's bottom left, with a slim margin: how far
// right the list reaches, and its top and bottom.
const right = LIST_LEFT + listBox.width + 8;
const top = STUCK_TOP - 4;
const bottom = STUCK_TOP + listBox.height + 8;
const reach = Math.sqrt(Math.max(edge * edge - right * right, 0));
const drop = Math.min(Math.max(0, bottom - reach), (top + bottom) / 2);
// Off screen by `back`, if the list's corners are still out; at
// most MAX_BACK, since a list as wide as its column can't be
// taken in without crossing into the content (it nearly can't
// happen: titles wrap first).
const half = (bottom - top) / 2;
const gap = Math.max(edge - right, 1);
const back =
Math.hypot(right, Math.max(bottom - drop, drop - top)) <= edge
? 0
: Math.min(MAX_BACK, Math.max(0, (half * half - gap * gap) / (2 * gap) - right));
const radius = edge + back;
return { size: radius * 2, left: -back - radius, top: listTop - STUCK_TOP + drop - radius };
} }
return { return {
size: circle, size: circle,