From 9c0f4b8c024317e1e25efa0b15ff5bba8223961a Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Tue, 17 Nov 2026 00:37:20 -0500 Subject: [PATCH] The active pane's other edges drawn with the curves, so moving between panes repaints only those lines A frame over the whole pane repainted the whole pane at every move (the forks keypress-to-paint median rose by half a frame); its left, foot and right are now a hairline path in the curves' layer, under what peeks, cut where the next column or pane covers it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab --- e2e/forks.spec.ts | 2 +- e2e/helpers.ts | 2 +- e2e/panes4.spec.ts | 12 ++++++++---- src/ui/Panes.tsx | 23 ++++++++++++++++++++++- src/ui/style.css | 5 +++-- 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/e2e/forks.spec.ts b/e2e/forks.spec.ts index 7bbf0d6..854c218 100644 --- a/e2e/forks.spec.ts +++ b/e2e/forks.spec.ts @@ -375,7 +375,7 @@ test("each fork has a colour, shared by its curve and the rule under its title; expect((await curve("Simple cells")).stroke).not.toBe((await curve("Complex cells")).stroke); expect((await curve("Simple cells")).stroke).not.toBe((await curve("Eukaryote")).stroke); // The active pane's heavy ink rule is as it was. - expect(await page.locator(".pane.active").evaluate((el) => getComputedStyle(el, "::after").borderTopWidth)).toBe("3px"); + expect(await page.locator(".pane.active").evaluate((el) => getComputedStyle(el, "::after").height)).toBe("3px"); // Off: plain ink everywhere, as before colours. await page.keyboard.press(":"); await page.keyboard.type("/colors off"); diff --git a/e2e/helpers.ts b/e2e/helpers.ts index ba8a47f..71caa16 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -179,7 +179,7 @@ export const curveFaults = (page: Page) => const svg = document.querySelector(".curves")!.getBoundingClientRect(); const box = { left: Math.round(svg.left), top: Math.round(svg.top) }; const placed = new Map(ie.panesPlaced.map((x: any) => [x.node.id, x])); - for (const p of document.querySelectorAll(".curves path:not(.foot)")) { + for (const p of document.querySelectorAll(".curves path:not(.foot):not(.frame)")) { const to = Number(p.dataset.to); const from = Number(p.dataset.from); const ce = document.querySelector(`.pane[data-tid="${to}"]`); diff --git a/e2e/panes4.spec.ts b/e2e/panes4.spec.ts index 00338e8..7942585 100644 --- a/e2e/panes4.spec.ts +++ b/e2e/panes4.spec.ts @@ -136,12 +136,16 @@ test("the selection bar is over the curves and under a pane peeking over it; cur await noFaults(page, "with the bar (its place clear of the curves)"); const z = await page.evaluate(() => ({ curves: Number(getComputedStyle(document.querySelector(".curves")!).zIndex), peek: 6 })); expect(z.curves).toBeGreaterThan(z.peek); - // The active pane: its other edges in the strong ink too. + // The active pane: the heavy rule on top, its other edges in the strong ink (drawn with the curves, along its left, foot and right). const frame = await page.locator(".pane.active").evaluate((el) => { - const a = getComputedStyle(el, "::after"); - return { top: a.borderTopWidth, left: a.borderLeftWidth, right: a.borderRightWidth, bottom: a.borderBottomWidth, same: a.borderLeftColor === a.borderRightColor && a.borderRightColor === a.borderBottomColor, notRule: a.borderLeftColor !== getComputedStyle(el).borderRightColor }; + const r = el.getBoundingClientRect(); + const f = document.querySelector(".curves path.frame"); + if (!f) return null; + const a = f.getPointAtLength(0); + const b = f.getPointAtLength(f.getTotalLength()); + return { rule: getComputedStyle(el, "::after").height, left: Math.abs(a.x - r.left) < 1.5, right: Math.abs(b.x - r.right) < 1.5, stroke: getComputedStyle(f).stroke !== getComputedStyle(el).borderRightColor }; }); - expect(frame).toEqual({ top: "3px", left: "1px", right: "1px", bottom: "1px", same: true, notRule: true }); + expect(frame).toEqual({ rule: "3px", left: true, right: true, stroke: true }); }); test("a menu's button closes the menu it opened: the top bar's, and a pane's ⋯", async ({ page }) => { diff --git a/src/ui/Panes.tsx b/src/ui/Panes.tsx index 47b5a0a..5cea100 100644 --- a/src/ui/Panes.tsx +++ b/src/ui/Panes.tsx @@ -1003,7 +1003,8 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) { if (rr && rr.bottom <= Math.max(cbox.top, scroll.top) + TAB) { folded = true; ey = cbox.top + TAB / 2; - } else if (rr && ruleShows(ce, ccolBox, below) && rr.left < shownRight) { + } else if (rr && rr.bottom > Math.max(cbox.top, ccolBox.top, scroll.top) + TAB && rr.bottom <= Math.min(below, ccolBox.bottom, scroll.bottom) && rr.left < shownRight) { + // (ruleShows, from what is measured here already.) ey = level(rr.bottom - 0.5); ex = Math.max(left + ARRIVE, rr.left); rule = { x0: ex, x1: Math.min(rr.right, shownRight) }; @@ -1125,6 +1126,26 @@ function curves(el: HTMLElement | null, svg: SVGSVGElement | null) { for (const g of [...lanesUsed.keys()]) if (!gutters.has(g)) lanesUsed.delete(g); const fx = (n: number) => Math.round(n * 1000) / 1000; const out: { key: string; from: number; to: number; lane: number; cls: string; d: string; hue: string }[] = []; + // The active pane's edges (left, foot, right), where they show: in the stronger ink, a hairline each. + const act = el.querySelector(".pane.active"); + if (act) { + const r = act.getBoundingClientRect(); + const col = act.parentElement!; + const c = col.getBoundingClientRect(); + const next = col.classList.contains("crowded") ? ((act.nextElementSibling as HTMLElement | null)?.getBoundingClientRect().top ?? Infinity) : Infinity; + const cover = (col.nextElementSibling as HTMLElement | null)?.getBoundingClientRect().left ?? Infinity; + const h = wd / dpr / 2; + const top = Math.max(r.top, c.top) + 3; + const bottom = Math.min(r.bottom, next, c.bottom); + const x0 = Math.round(r.left * dpr) / dpr + h; + const right = Math.min(r.right, cover); + const x1 = Math.round(right * dpr) / dpr - h; + const yb = Math.round(bottom * dpr) / dpr - h; + if (bottom > top) { + const d = right < r.right - 1 ? `M${fx(x0 - box.left)} ${fx(top - box.top)}V${fx(yb - box.top)}H${fx(right - box.left)}` : `M${fx(x0 - box.left)} ${fx(top - box.top)}V${fx(yb - box.top)}H${fx(x1 - box.left)}V${fx(top - box.top)}`; + out.push({ key: "frame", from: Number(act.dataset.tid), to: -1, lane: -1, cls: "frame", d, hue: "" }); + } + } for (const [id, f] of feet) if (!tabbed.has(id)) out.push({ key: `foot:${id}`, from: id, to: -1, lane: -1, cls: f.on ? "foot on" : "foot", d: `M${fx(f.x0)} ${fx(f.y)}H${fx(f.x1)}`, hue: f.hue === undefined ? "" : String(f.hue) }); edges.sort((a, b) => Number(a.on) - Number(b.on)); for (const e of edges) { diff --git a/src/ui/style.css b/src/ui/style.css index 5b14ab3..ea6502a 100644 --- a/src/ui/style.css +++ b/src/ui/style.css @@ -467,8 +467,9 @@ kbd, .help code { font-family: var(--mono); font-size: 0.86em; border: 1px solid * badge is set in the same ink. */ .pane::after { content: ""; position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 0; background: var(--fg); pointer-events: none; } -/* The active pane: the heavy rule across its top, and its other three edges in the stronger ink (the same hairline width), over the hairlines it shares with its neighbours. */ -.pane.active::after { bottom: 0; height: auto; z-index: 5; background: none; border: 1px solid var(--edge-strong); border-top: 3px solid var(--fg); } +/* The active pane: the heavy rule across its top; its other three edges in the stronger ink are drawn with the curves (Panes.tsx), over the hairlines it shares with its neighbours, so a move from pane to pane repaints only those lines. */ +.pane.active::after { height: 3px; } +.panes .curves path.frame.frame { stroke: var(--edge-strong); fill: none; stroke-dasharray: none; } .pane.on-branch:not(.active)::after { height: 1px; background: var(--faint); } /* The curves: from what each pane was opened from to its title, behind nothing but in the gaps between lines. */