f6e4a4f6bd
The map view now selects a DARK_THEME or LIGHT_THEME palette from the resolved app theme and threads it through every primitive builder, so the canvas, planets, ship groups, cargo routes, battle/bombing markers, fog, reach + selection rings, pending-Send tracks, and the pick overlay all switch with the rest of the chrome. A theme flip remounts the renderer preserving the camera — Pixi bakes the background at init and every primitive bakes its colour at build, so a live re-tint is not possible on the same instance. This also fixes the reported bug: the gear-popover trigger and the loading overlay hardcoded a dark navy background, so in light theme the gear was invisible (dark icon on dark chip) until hover flipped it to a white chip. Both now use the --color-surface-overlay token and read correctly in both themes. The light palette mirrors the dark one role-for-role, darkened / saturated for contrast on a light background while keeping the incoming, battle, and bombing accents vivid. The values are a first pass meant to be refined during the F8 manual-QA loop. Removes the now-dead "Phase 35" references from the code and lifts the map-recoloring prohibition from the design-system / renderer docs; the battle scene stays a fixed-palette data-viz surface. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { computeSelectionRing, SELECTION_RING_ID } from "../src/map/selection-ring";
|
|
import { DARK_THEME, LIGHT_THEME } from "../src/map/world";
|
|
|
|
const planets = [
|
|
{ number: 1, x: 10, y: 20 },
|
|
{ number: 2, x: 30, y: 40 },
|
|
];
|
|
|
|
describe("computeSelectionRing", () => {
|
|
it("returns null when nothing is selected", () => {
|
|
expect(computeSelectionRing(planets, null)).toBeNull();
|
|
});
|
|
|
|
it("returns null when the selected planet is absent from the report", () => {
|
|
expect(computeSelectionRing(planets, 99)).toBeNull();
|
|
});
|
|
|
|
it("rings the selected planet at its coordinates", () => {
|
|
const ring = computeSelectionRing(planets, 2);
|
|
expect(ring).toMatchObject({
|
|
kind: "circle",
|
|
id: SELECTION_RING_ID,
|
|
x: 30,
|
|
y: 40,
|
|
hitSlopPx: 0,
|
|
});
|
|
// Defaults to the dark palette.
|
|
expect(ring?.style.strokeColor).toBe(DARK_THEME.selectionRing);
|
|
// Sits outside the planet marker (radius 6 world units).
|
|
expect(ring?.radius ?? 0).toBeGreaterThan(6);
|
|
});
|
|
|
|
it("uses the supplied palette's ring colour", () => {
|
|
const ring = computeSelectionRing(planets, 2, LIGHT_THEME);
|
|
expect(ring?.style.strokeColor).toBe(LIGHT_THEME.selectionRing);
|
|
expect(LIGHT_THEME.selectionRing).not.toBe(DARK_THEME.selectionRing);
|
|
});
|
|
});
|