Skip to content

Corkboard: disc nodes by default, pins one row away - #510

Merged
AllTerrainDeveloper merged 2 commits into
trunkfrom
corkboard-node-style
Aug 23, 2026
Merged

AllTerrainDeveloper merged 2 commits into
trunkfrom
corkboard-node-style

Conversation

@AllTerrainDeveloper

@AllTerrainDeveloper AllTerrainDeveloper commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator
image

Why

Every Corkboard node was the post type's Dashicon glyph — for posts, the pushpin. The loudest possible mark on the most common node, and it didn't sit with the rest of the app.

What

Nodes are discs coloured by post type. Same palette the relationship satellites already use, so a focused post and the bubbles fanned around it read as one system rather than two. Sizing is unchanged (8 + √degree × 2.4); a keyline keeps overlapping nodes readable at low zoom. Focus scales the disc, fills it with the accent, and reveals the glyph inside — hover does too — so neither costs the user the type information.

Discs repaint only when their signature changes. A fill + stroke per node per frame is fine for a demo graph and not for a real site's few hundred posts; in steady state it's zero repaints.

Pins are one row away. "Show pins" in the window's ⋯ menu, persisted in localStorage (desktop-mode/corkboard-node-style).

Checkbox rows for registerWindowAction()

(This replaces the registerWindowMenuItem() API the first draft of this PR proposed. registerWindowAction() landed on trunk in the meantime and is the better-developed surface — it has a PHP opt-in, a server-sync module, and a working owner sweep. Shipping a second parallel registry alongside it would have been a mistake, so the new API is gone and its one genuinely new capability moved across.)

Window actions had only ever been verbs. "Show pins" is a preference, so WindowActionDef grows a second row shape:

  • checkable: true + checked( win ) — painted as role="menuitemcheckbox", ticked from the reader. checkable without checked throws: a checkbox nobody can ask renders permanently unticked, which reads as broken persistence in the plugin rather than a missing field in the def.
  • checked() is asked, never told — re-read on every menu open, so a plugin persists its preference and repaints nothing, and the row can't disagree with the plugin for longer than one open.
  • Clicking flips the tick optimistically and leaves the menu open, so the user watches it land and can flip back without reopening. closeOnSelect overrides the per-shape default in either direction.

flipStartupCheckOptimistically → flipMenuItemCheckOptimistically. The body was always generic; plugin checkboxes now share it with "Open on startup".

The docs make the choice between the two shapes explicit, because they aren't interchangeable: a relabelling label function is right when the two states are two places the window can be ("Send to your Mac" / "Bring back into OpenStation") — the row names the move. A checkbox is right when they're one setting the window either has or doesn't: a tick says "there is a thing here, and it is currently off", which a label reading "Show pins" alone cannot.

Supersampling the canvas

Second commit, and separable if you'd rather it went on its own.

The scene asked for antialias: true and rendered at min(devicePixelRatio, 2) — native density on any Retina display, so MSAA and no supersampling. Enough for a large shape; not for these. A node is 8–16 world units across wearing a 1.5-unit keyline, and the overview sits near 0.5× zoom. There the keyline is under a device pixel: MSAA has nothing to average and the ring breaks into a dotted shimmer — losing exactly the thing the ring is for, which is keeping two overlapping nodes readable as two nodes.

So: render 1.5× above DPR, clamped at 3 (the cost is quadratic and the canvas is full-window; a 1400×800 stage is 10M pixels at 3 and 18M at 4). autoDensity already holds the canvas at its CSS size, so nothing about the layout moves. RENDER_SUPERSAMPLE = 1 restores the old behaviour.

Both Text layers move off their pinned resolution: 2 onto the same number. A glyph rasterised below the density of the canvas around it gets upscaled, and the icon is now the focus/hover reveal inside the disc — it would have been the one soft thing on a screen that just got sharper everywhere else.

If it's still not clean enough the next step is different in kind: bake one white circle+ring into a RenderTexture and use tinted Sprites, which gives free filtering at every zoom and collapses every disc into one draw call. The trade is that the keyline then scales with the disc instead of holding a constant world width.

Tests

typecheck / lint / build clean, test:js green (380 files, 4838 tests). New coverage: checkable-row validation (including the checkable-without-checked throw), the checked resolver's re-read-never-cache contract and its throwing-reader containment, checkbox painting and the glyphless leading edge, the optimistic flip surviving a throwing handler, closeOnSelect in both directions; plus node-style default, constructor-passed style, cache invalidation on toggle and non-invalidation on a redundant call.

No PHP changed. Docs updated in the same change: javascript-reference.md, api-index.md, the Corkboard section of hooks-reference.md, and a checkbox section in the existing examples/window-action.md.

Rebased onto trunk (was 101 commits behind).

Manual check

Open Corkboard, confirm discs on first paint, ⋯ → Show pins and back — the tick should flip with the menu staying open — then reload to confirm it sticks. Worth an eye on whether the keyline reads cleanly at overview zoom now, and on whether disc sizes work at that zoom — the one thing tests can't tell you.

🤖 Generated with Claude Code

Open WordPress Playground Preview

AllTerrainDeveloper and others added 2 commits August 23, 2026 19:05
Nodes were the post type's Dashicon glyph, which for posts is the
pushpin — the loudest possible mark for the most common node. They are
now discs coloured by post type, using the same palette the
relationship satellites use so a focused post and the bubbles fanned
around it read as one system. Focus and hover reveal the glyph inside
the disc, so neither costs the user the type information.

Discs repaint only when their signature changes; a fill + stroke per
node per frame is affordable for a demo graph and is not for a real
site's few hundred posts.

The pins are still there, behind "Show pins" in the window's ⋯ menu,
persisted in localStorage. That row is a checkbox, and window actions
had only ever been verbs — so `WindowActionDef` grows `checkable` plus
a `checked` reader re-read on every menu open, which is what lets a
plugin persist a preference and repaint nothing. `closeOnSelect`
overrides the per-shape default: a verb closes the menu, a checkbox
stays open so the user watches the tick land.

`flipStartupCheckOptimistically` becomes `flipMenuItemCheckOptimistically`
— the body was always generic, and plugin checkboxes now share it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The scene asked for MSAA and rendered at the display's own density,
which is enough for a large shape and not for these: a node is 8-16
world units across and wears a 1.5-unit keyline, and the overview sits
at ~0.5x zoom. There the keyline is under a device pixel, MSAA has
nothing to average, and the ring breaks into a dotted shimmer - losing
exactly the thing it is for, which is keeping two overlapping nodes
readable as two nodes.

Render 1.5x above device-pixel ratio (clamped at 3, since the cost is
quadratic and the canvas is full-window) and let the browser resolve
the extra samples down on composite. `autoDensity` already keeps the
canvas at its CSS size, so nothing about the layout moves.

Both `Text` layers move off their pinned `resolution: 2` onto the same
number. A glyph rasterised below the density of the canvas around it
is upscaled, and the icon is now the focus/hover reveal *inside* the
disc - it would have been the one soft thing on a sharper screen.

Set RENDER_SUPERSAMPLE to 1 to get the previous behaviour back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@AllTerrainDeveloper
AllTerrainDeveloper enabled auto-merge (squash) August 23, 2026 17:24
@AllTerrainDeveloper
AllTerrainDeveloper merged commit fce08cc into trunk Aug 23, 2026
5 checks passed
@AllTerrainDeveloper
AllTerrainDeveloper deleted the corkboard-node-style branch August 23, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant