feat: make Big Screen a holographic visor

The map fills the viewport and every control is light: thin mint lines and
glowing text over a vignette, a faint scan, corner brackets and a glass edge.
Brand and mode sit top left, telemetry top right, the legend bottom left, the
systems as text tabs bottom centre, and view, motion, search and sign out as
outlined keys bottom right with the hub's state above them.

Each piece springs between the workspace and the big screen with
useScreenTransition. Every orbit is labelled on the big screen, and the picked
orbit's label stands off its star on an elbowed leader line with its status.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 16:47:23 +07:00
parent 64d916db4e
commit 5773f42d90
7 changed files with 219 additions and 24 deletions

View File

@@ -23,6 +23,7 @@ import { SpringPane } from "./components/ui/SpringPane";
import { SnapshotSheet } from "./components/vault/SnapshotSheet";
import { useActivity } from "./hooks/useActivity";
import { useReducedMotion } from "./hooks/useReducedMotion";
import { useScreenTransition } from "./hooks/useScreenTransition";
import { orbitStatus } from "./lib/format";
import { groupSnapshots } from "./lib/galaxyLayout";
import type { FailureCause } from "./lib/orbitActivity";
@@ -89,6 +90,8 @@ function VaultApp({ actor, onLogout, caps }: { actor?: string; onLogout?: () =>
const [restoreBusy, setRestoreBusy] = useState(false);
const [restoreTarget, setRestoreTarget] = useState<{ id: string | null }>();
const reducedMotion = useReducedMotion();
const tools = useRef<HTMLDivElement>(null);
useScreenTransition(tools, bigScreen, reducedMotion);
const qc = useQueryClient();
useEffect(() => {
@@ -314,7 +317,7 @@ function VaultApp({ actor, onLogout, caps }: { actor?: string; onLogout?: () =>
<div><strong>Tessera</strong><span>Flight deck · Backup control</span></div>
</div>
<HUDRail active={mode === "snapshot" || mode === "reconstitute" ? "scene" : mode} items={railItems} alerts={{ activity: activity.counts.needs > 0 }} floating={bigScreen} panelOpen={panelOpen} reducedMotion={reducedMotion} onSelect={openConsole} />
<div className="vault-topbar-tools">
<div className="vault-topbar-tools" ref={tools}>
<p className="hub-link" role="status">
<span className={`register-signal signal-${online ? "green" : "grey"}`} />
{online ? "Hub online" : health.isPending ? "Connecting" : "Hub offline"}

View File

@@ -156,7 +156,7 @@ export function HUDRail({
}
}}
>
<motion.svg className="nav-liquid" aria-hidden="true" initial={false} animate={{ opacity: floating ? 1 : 0 }}>
<motion.svg className="nav-liquid" aria-hidden="true" initial={false} animate={{ opacity: 0 }}>
<defs>
<filter id={`${id}-goo`} x="-25%" y="-50%" width="150%" height="200%">
<feGaussianBlur in="SourceGraphic" stdDeviation="3.5" result="blur" />
@@ -175,7 +175,7 @@ export function HUDRail({
</motion.svg>
<span aria-hidden="true" className="nav-text-dock" />
<motion.span aria-hidden="true" className="nav-underline" style={{ x: center, width }}
initial={false} animate={{ opacity: floating ? 0 : 1 }} />
initial={false} animate={{ opacity: 1 }} />
{items.map(({ id, label, icon }) => (
<button
key={id}
@@ -189,10 +189,10 @@ export function HUDRail({
>
<motion.svg className="nav-icon" viewBox="0 0 24 24" width="22" height="22" fill="none"
stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"
initial={false} animate={{ opacity: floating ? 1 : 0 }}>
initial={false} animate={{ opacity: 0 }}>
<path d={icon} />
</motion.svg>
<motion.span className="nav-label" aria-hidden="true" initial={false} animate={{ opacity: floating ? 0 : 1 }}>
<motion.span className="nav-label" aria-hidden="true" initial={false} animate={{ opacity: 1 }}>
{label}
</motion.span>
</button>

View File

@@ -41,6 +41,9 @@ const HALF_WIDTH = SCENE_WIDTH / 2;
const HALF_HEIGHT = SCENE_HEIGHT / 2;
const labelFont = "500 11px ui-monospace, monospace";
const MAX_LABELS = 12;
const MAX_BIG_LABELS = 60;
/** On the big screen the picked orbit's label stands off its star, on the end of an elbowed leader line. */
const BIG_LABEL_GAP = 64;
const clamp = (value: number) => Math.max(0, Math.min(1, value));
const ACCRETION_SECONDS = 6.4;
/** Glow falloff, close to a gaussian so there is no visible edge. */
@@ -359,7 +362,8 @@ export function BlackholeGalaxy({
orbit.id === selectedOrbitId ? 0 : shownStatus(orbit) === "failed" ? 1 : orbitStatus(shownStatus(orbit)).busy ? 2 : 3;
const labelCandidates = [...visible].sort((a, b) => byPriority(a) - byPriority(b))
.filter((orbit) => width >= 530 || orbit.id === selectedOrbitId)
.slice(0, MAX_LABELS);
// The big screen has room for every orbit; placement still drops a label that would land on another.
.slice(0, bigScreen ? MAX_BIG_LABELS : MAX_LABELS);
const box = (point: Vec2, r: number): Rect => {
const { x, y } = screen(point);
return { x: x - r, y: y - r, width: r * 2, height: r * 2 };
@@ -374,7 +378,7 @@ export function BlackholeGalaxy({
labels = placeLabels(labelCandidates.map(({ id, name }) => {
const point = screen(orbitPose(slots.get(id)!, lockedPhase));
return { id, ...point, width: Math.min(146, Math.ceil(measure?.measureText(name).width ?? name.length * 7) + 16) };
}), width, height, [core, ...markers, ...moons.map((moon) => box(moon, 12))], selectedOrbitId);
}), width, height, [core, ...markers, ...moons.map((moon) => box(moon, 12))], selectedOrbitId, bigScreen ? BIG_LABEL_GAP : 0);
}
const focusLabel = labels.find(({ id }) => id === selectedOrbitId);
@@ -505,7 +509,22 @@ export function BlackholeGalaxy({
</g>
);
})}
{selectedPosition && focusLabel && (
{selectedPosition && focusLabel && bigScreen && (() => {
// Diagonal out of the star, a dot at the bend, then level into the near edge of the label.
const star = screen(selectedPosition);
const toRight = focusLabel.x + focusLabel.width / 2 >= star.x;
const endX = toRight ? focusLabel.x - 6 : focusLabel.x + focusLabel.width + 6;
const endY = focusLabel.y + LABEL_HEIGHT / 2;
const bendX = endX - (toRight ? 1 : -1) * Math.min(Math.abs(endX - star.x) * 0.6, 120);
const point = (x: number, y: number) => `${x / scale - HALF_WIDTH} ${y / scale - HALF_HEIGHT}`;
return (
<g className="focus-leader-big">
<path className="focus-leader" d={`M${point(star.x, star.y)} L${point(bendX, endY)} L${point(endX, endY)}`} fill="none" />
<circle className="focus-leader-dot" r="2" cx={bendX / scale - HALF_WIDTH} cy={endY / scale - HALF_HEIGHT} />
</g>
);
})()}
{selectedPosition && focusLabel && !bigScreen && (
<motion.line className="focus-leader"
x1={selectionX} y1={selectionY} initial={false}
animate={{
@@ -523,6 +542,11 @@ export function BlackholeGalaxy({
{labelCandidates.find((orbit) => orbit.id === id)?.name}
</span>
))}
{bigScreen && focusLabel && (
<span className="scene-label-note" style={{ left: `${100 * focusLabel.x / width}%`, top: `${100 * (focusLabel.y + LABEL_HEIGHT - 4) / height}%`, opacity: reducedMotion ? 1 : "var(--lock-reveal)" }}>
{orbitStatus(shownStatus(visible.find(({ id }) => id === selectedOrbitId)!)).label}
</span>
)}
</div>
{orbits.length >= orbitCapacity && <p className="scene-density">Select an orbit in the list to inspect it</p>}
</motion.div>

View File

@@ -1,5 +1,6 @@
import { BlackholeGalaxy, type CaptureEffect } from "./BlackholeGalaxy";
import { useCallback, useState, type KeyboardEvent } from "react";
import { useCallback, useRef, useState, type KeyboardEvent } from "react";
import { useScreenTransition } from "../../hooks/useScreenTransition";
import { BlackholeBackdrop } from "./BlackholeBackdrop";
import { SpaceBackdrop } from "./SpaceBackdrop";
import type { CoreSignal } from "../../lib/blackhole/controller";
@@ -35,11 +36,19 @@ export function VaultScene({
const selected = orbits.find(({ id }) => id === selectedOrbitId);
const screenLabel = bigScreen ? "Exit big screen" : "Big screen";
const flowLabel = reducedMotion ? "Reduced motion" : flowing ? "Pause motion" : "Resume motion";
// Each piece of the toolbar and sill springs from its place on the canopy to its corner of the big screen.
const status = useRef<HTMLDivElement>(null);
const keys = useRef<HTMLDivElement>(null);
const legend = useRef<HTMLDivElement>(null);
useScreenTransition(status, bigScreen, reducedMotion);
useScreenTransition(keys, bigScreen, reducedMotion);
useScreenTransition(legend, bigScreen, reducedMotion);
const caption = { initial: false, animate: { opacity: bigScreen ? 0 : 1 }, "aria-hidden": true } as const;
return (
<section className="vault-scene" aria-label="Orbital map">
{svgCore ? <SpaceBackdrop /> : <BlackholeBackdrop signal={signal} bigScreen={bigScreen} radar={radar} reducedMotion={reducedMotion} onUnavailable={showSvgCore} />}
<div className="scene-toolbar">
<div>
<div ref={status}>
<p className="instrument-label">Vault map</p>
<p className="scene-mode">
<motion.span className="mode-signal" initial={false} animate={{
@@ -52,8 +61,9 @@ export function VaultScene({
</p>
</div>
<div className="scene-controls">
{!svgCore && <ViewSwitch radar={radar} onChange={(next) => next !== radar && onToggleRadar()} />}
<div className="scene-controls-end">
{!svgCore && <ViewSwitch radar={radar} bigScreen={bigScreen} reducedMotion={reducedMotion} caption={caption}
onChange={(next) => next !== radar && onToggleRadar()} />}
<div className="scene-controls-end" ref={keys}>
<button className="console-control icon-key" onClick={onToggleFlow} disabled={reducedMotion} type="button"
aria-label={flowLabel} title={flowLabel}>
<svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true">
@@ -76,7 +86,7 @@ export function VaultScene({
: <path d="M5 2H2v3m9-3h3v3M5 14H2v-3m9 3h3v-3" />}
</svg>
</button>
<span className="sill-caption" aria-hidden="true">Motion · Screen</span>
<motion.span className="sill-caption" {...caption}>Motion · Screen</motion.span>
</div>
</div>
</div>
@@ -98,14 +108,14 @@ export function VaultScene({
/>
<div className="scene-footer">
<p>01 <span>·</span> Orbital projection</p>
<div className="scene-legend" aria-label="Map legend">
<div className="scene-legend" aria-label="Map legend" ref={legend}>
<span><i className="legend-orbit" /> Orbit</span>
<span><i className="legend-failed" /> Failed</span>
<span><i className="legend-snapshot" /> Snapshot</span>
<span className="sill-caption" aria-hidden="true">Legend</span>
<motion.span className="sill-caption" {...caption}>Legend</motion.span>
</div>
</div>
<div className="canopy-frame" aria-hidden="true">
<motion.div className="canopy-frame" aria-hidden="true" initial={false} animate={{ opacity: bigScreen ? 0 : 1 }}>
<i className="canopy-bezel canopy-bezel--edge" />
<i className="canopy-bezel" />
<i className="canopy-corner canopy-corner--tl" />
@@ -115,7 +125,7 @@ export function VaultScene({
<i className="canopy-screw canopy-screw--l" />
<i className="canopy-screw canopy-screw--r" />
<span className="canopy-plate">Canopy 01 · Forward</span>
</div>
</motion.div>
</section>
);
}
@@ -126,7 +136,15 @@ const switchLook = {
} as const;
/** The two looks of the canopy as a two-position switch. The thumb rides the shared MotionConfig spring. */
function ViewSwitch({ radar, onChange }: { radar: boolean; onChange: (radar: boolean) => void }) {
function ViewSwitch({ radar, bigScreen, reducedMotion, caption, onChange }: {
radar: boolean;
bigScreen: boolean;
reducedMotion: boolean;
caption: object;
onChange: (radar: boolean) => void;
}) {
const root = useRef<HTMLDivElement>(null);
useScreenTransition(root, bigScreen, reducedMotion);
const arrows = (event: KeyboardEvent) => {
if (event.key === "ArrowLeft" || event.key === "ArrowUp") onChange(false);
else if (event.key === "ArrowRight" || event.key === "ArrowDown") onChange(true);
@@ -137,8 +155,8 @@ function ViewSwitch({ radar, onChange }: { radar: boolean; onChange: (radar: boo
next?.focus();
};
return (
<div className="view-switch" role="radiogroup" aria-label="Canopy view">
<span className="sill-caption" aria-hidden="true">View select</span>
<div className="view-switch" role="radiogroup" aria-label="Canopy view" ref={root}>
<motion.span className="sill-caption" {...caption}>View select</motion.span>
<motion.span className="view-switch-thumb" aria-hidden="true" initial={false}
animate={radar ? switchLook.radar : switchLook.window} />
<button type="button" role="radio" aria-checked={!radar} aria-label="Window view" title="Window view"

View File

@@ -1053,3 +1053,145 @@ button.act-row[data-group="needs"]:hover { background: #20161a; }
.datepicker-grid button:disabled { opacity: .35; cursor: default; }
.datepicker-foot { display: flex; justify-content: space-between; padding-top: 8px; }
.datepicker-foot button:disabled { opacity: .4; cursor: default; }
/* Big Screen: a holographic visor. No panels and no plates, only light: thin lines and glowing text laid over the
whole sky, the way a pilot reads a helmet display. Each piece keeps the counterpart the morph springs it to. */
.big-screen {
--holo: #9fe8d4;
--holo-bright: #d8fff3;
--holo-dim: #6fb5a3;
--holo-line: rgba(159, 232, 212, .38);
/* the dark halo keeps the ink legible over the bright disk */
--holo-glow: 0 0 8px rgba(120, 232, 205, .55), 0 1px 3px #000d;
--edge: 50px;
--key: 38px;
background: #04060a;
}
.big-screen .vault-main, .big-screen .vault-workspace { background: none; }
/* the visor: vignette and a faint scan over the scene, four corner brackets, a glass edge */
.big-screen .vault-scene::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
background:
repeating-linear-gradient(to bottom, transparent 0 2px, rgba(159, 232, 212, .03) 2px 3px),
radial-gradient(ellipse at 50% 50%, transparent 52%, #02040a 118%);
}
.big-screen::before {
--b: linear-gradient(var(--holo), var(--holo));
content: "";
position: absolute;
inset: 0;
z-index: 2;
pointer-events: none;
opacity: .75;
background:
var(--b) left 26px top 26px / 46px 1.2px no-repeat, var(--b) left 26px top 26px / 1.2px 46px no-repeat,
var(--b) right 26px top 26px / 46px 1.2px no-repeat, var(--b) right 26px top 26px / 1.2px 46px no-repeat,
var(--b) left 26px bottom 26px / 46px 1.2px no-repeat, var(--b) left 26px bottom 26px / 1.2px 46px no-repeat,
var(--b) right 26px bottom 26px / 46px 1.2px no-repeat, var(--b) right 26px bottom 26px / 1.2px 46px no-repeat;
}
.big-screen::after {
content: "";
position: absolute;
inset: 12px;
z-index: 2;
pointer-events: none;
border: 1px solid rgba(159, 232, 212, .14);
border-radius: 34px;
box-shadow: inset 0 0 40px rgba(120, 232, 205, .07);
}
.big-screen .canopy-frame { display: block; }
.big-screen .sill-caption { display: block; }
/* top left: where we are */
.big-screen .vault-brand { display: block; position: absolute; z-index: 31; top: 40px; left: var(--edge); }
.big-screen .vault-brand svg, .big-screen .vault-brand span { display: none; }
.big-screen .vault-brand strong { font: 500 11px/1 var(--font-mono); letter-spacing: .3em; text-transform: uppercase; color: var(--holo-bright); text-shadow: var(--holo-glow); }
.big-screen .vault-brand strong::after { content: " · Flight deck"; }
.big-screen .vault-scene > .scene-toolbar { inset: 66px auto auto var(--edge); }
.big-screen .scene-toolbar > div:first-child { display: block; height: auto; max-width: none; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.big-screen .scene-toolbar > div:first-child .scene-mode { display: flex; align-items: center; gap: 9px; margin: 0; font: 500 10px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--holo); text-shadow: var(--holo-glow); }
.big-screen .scene-focus { max-width: 22ch; color: var(--holo-bright); }
/* top right: telemetry as light */
.big-screen .vault-overview { inset: 40px var(--edge) auto auto; }
.big-screen .vault-telemetry { display: flex; align-items: center; height: auto; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; }
.big-screen .vault-telemetry > div { display: flex; align-items: baseline; gap: 9px; padding: 0 18px; }
.big-screen .vault-telemetry > div:last-child { padding-right: 0; }
.big-screen .vault-telemetry > div + div { border-left: 1px solid rgba(159, 232, 212, .25); }
.big-screen .vault-telemetry dt { font-size: 9px; letter-spacing: .2em; color: var(--holo-dim); text-shadow: var(--holo-glow); }
.big-screen .vault-telemetry dd { font-size: 15px; line-height: 1; color: var(--holo-bright); text-shadow: var(--holo-glow); }
.big-screen .vault-telemetry > [data-metric="failed"][data-state="ok"] dd { color: var(--color-orbit-green); }
.big-screen .vault-telemetry .telemetry-alert { color: var(--color-orbit-red); }
/* bottom left: the key */
.big-screen .vault-scene > .scene-footer { display: flex; position: absolute; z-index: 3; inset: auto auto 46px var(--edge); height: auto; padding: 0; border: 0; background: none; }
.big-screen .scene-footer > p { display: none; }
.big-screen .scene-legend { height: auto; padding: 0; gap: 18px; flex-wrap: nowrap; background: none; border: 0; border-radius: 0; box-shadow: none; font: 500 9.5px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--holo); text-shadow: var(--holo-glow); }
/* bottom centre: systems as text, the active one held in a glowing frame */
.big-screen .vault-nav { bottom: 34px; width: max-content; max-width: calc(100% - 2 * var(--edge)); padding: 0; gap: 4px; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; }
.big-screen .vault-nav::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 260px; height: 1px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, rgba(159, 232, 212, .5), transparent); pointer-events: none; }
.big-screen .vault-nav button { display: flex; align-items: center; justify-content: center; width: auto; min-height: 36px; padding: 0 16px; border-radius: 0; font: 500 10.5px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--holo-dim); }
.big-screen .vault-nav button:hover { color: var(--holo); }
.big-screen .vault-nav button[aria-current] { color: var(--holo-bright); text-shadow: var(--holo-glow); }
.big-screen .vault-nav button[data-alert="true"] { color: var(--color-orbit-red); text-shadow: 0 0 8px #ff7a70aa, 0 1px 3px #000d; }
.big-screen .nav-label { position: static; }
.big-screen .nav-liquid, .big-screen .nav-text-dock { display: none; }
.big-screen .nav-underline { top: 5px; bottom: 5px; height: auto; }
.big-screen .nav-underline::before { inset: 0 -4px; border-radius: 3px; background: rgba(159, 232, 212, .06); border: 1px solid rgba(159, 232, 212, .65); box-shadow: 0 0 12px rgba(120, 232, 205, .25), inset 0 0 10px rgba(159, 232, 212, .10); }
/* bottom right: view, motion and screen, then search and sign out, with the hub's state above them */
.big-screen .scene-controls { position: fixed; z-index: 31; bottom: 42px; right: calc(var(--edge) + 2 * var(--key) + 25px); display: flex; align-items: center; gap: 16px; }
.big-screen .scene-controls-end { gap: 8px; }
.big-screen .vault-topbar-tools { position: absolute; z-index: 30; bottom: 42px; right: var(--edge); gap: 8px; }
.big-screen .hub-link { display: flex; position: absolute; right: 0; bottom: calc(100% + 12px); height: auto; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; font: 500 9px/1 var(--font-mono); letter-spacing: .2em; color: var(--holo-dim); text-shadow: var(--holo-glow); }
.big-screen :is(.scene-controls-end, .vault-topbar-tools) .icon-key {
border-color: var(--holo-line);
border-radius: 50%;
background: rgba(159, 232, 212, .04);
box-shadow: inset 0 0 10px rgba(159, 232, 212, .10), 0 0 12px rgba(120, 232, 205, .10);
color: var(--holo);
}
.big-screen :is(.scene-controls-end, .vault-topbar-tools) .icon-key svg { color: var(--holo); filter: drop-shadow(0 0 4px rgba(120, 232, 205, .7)); }
.big-screen :is(.scene-controls-end, .vault-topbar-tools) .icon-key:enabled:hover { border-color: var(--holo); background: rgba(159, 232, 212, .10); }
.big-screen :is(.scene-controls-end, .vault-topbar-tools) .icon-key:enabled:active { transform: none; background: rgba(159, 232, 212, .16); box-shadow: inset 0 0 12px rgba(159, 232, 212, .2); }
.big-screen .view-switch { display: flex; gap: 6px; height: var(--key); padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.big-screen .view-switch-thumb { display: none; }
.big-screen .view-switch svg { display: none; }
.big-screen .view-switch .scene-look-control { min-width: 0; height: var(--key); padding: 0 14px; border-radius: 0; border-bottom: 1.5px solid transparent; font-size: 10px; letter-spacing: .2em; color: var(--holo-dim); }
.big-screen .view-switch .scene-look-control span { display: inline; }
.big-screen .view-switch button[aria-checked="true"][data-look] { color: var(--holo-bright); text-shadow: var(--holo-glow); border-bottom-color: var(--holo); }
/* the map's own labels are light too */
/* keep the label's own font and padding: its width is measured with them, and any wider type is cut to an ellipsis */
.big-screen .scene-labels span { background: none; border-color: transparent; color: var(--holo); text-shadow: var(--holo-glow); }
.big-screen .scene-labels span.is-selected { color: var(--holo-bright); }
.big-screen .scene-labels .scene-label-note { position: absolute; display: block; height: auto; overflow: visible; background: none; border: 0; padding-inline: 7px; line-height: 1; font: 500 9px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--holo-dim); text-shadow: var(--holo-glow); }
.big-screen .focus-leader-dot { fill: var(--holo); filter: drop-shadow(0 0 4px rgba(120, 232, 205, .8)); }
.big-screen .focus-leader { stroke: var(--holo); opacity: .7; }
@media (max-width: 900px) {
.big-screen { --edge: 24px; }
.big-screen .vault-nav { bottom: 22px; }
.big-screen .vault-nav::after { bottom: -7px; }
.big-screen .vault-scene > .scene-footer { display: none; }
.big-screen .scene-controls { right: auto; left: var(--edge); bottom: 84px; }
.big-screen .vault-topbar-tools { bottom: 84px; }
.big-screen .vault-telemetry { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 0; }
.big-screen .vault-telemetry > div:nth-child(odd) { border-left: 0; }
}
@media (max-width: 520px) {
.big-screen { --key: 44px; }
.big-screen .vault-brand { display: none; }
.big-screen .vault-scene > .scene-toolbar { inset: 40px auto auto var(--edge); }
.big-screen .view-switch .scene-look-control { padding: 0; min-width: var(--key); }
.big-screen .view-switch .scene-look-control span { display: none; }
.big-screen .view-switch svg { display: inline; color: var(--holo); }
.big-screen .vault-nav button { padding: 0 7px; letter-spacing: .08em; font-size: 9.5px; }
.big-screen .vault-topbar-tools { top: auto; bottom: 84px; }
.big-screen .vault-overview { display: none; }
}

View File

@@ -14,17 +14,25 @@ export function placeLabels(
height: number,
obstacles: Rect[],
selectedId?: string,
/** The picked orbit's label keeps at least this far from its star, so a leader line has room to run. */
selectedMinGap = 0,
): Label[] {
const occupied = [...obstacles];
const placed: Label[] = [];
for (const label of candidates) {
const { x, y, width: w } = label;
const gaps = label.id === selectedId ? [12, 28, 44, 64, 88, 112, 144, 180] : [12, 28, 44];
const gaps = label.id === selectedId
? [12, 28, 44, 64, 88, 112, 144, 180].filter((gap) => gap >= selectedMinGap)
: [12, 28, 44];
const offsets = gaps.flatMap((gap) => [
[gap, -LABEL_HEIGHT / 2], [-w - gap, -LABEL_HEIGHT / 2],
[-w / 2, -LABEL_HEIGHT - gap], [-w / 2, gap],
[gap, -LABEL_HEIGHT - gap / 2], [-w - gap, gap / 2],
]);
// A label held off its star reads best up and to the side, where a leader line can bend into it.
if (label.id === selectedId && selectedMinGap > 0) {
offsets.sort((a, b) => Number(b[1] < -LABEL_HEIGHT / 2) - Number(a[1] < -LABEL_HEIGHT / 2));
}
for (const [dx, dy] of offsets) {
const rect = { x: x + dx, y: y + dy, width: w, height: LABEL_HEIGHT };
if (rect.x < GAP || rect.y < GAP || rect.x + w > width - GAP ||