feat(ui): Phase 29 map visibility toggles
Tests · Go / test (push) Successful in 2m31s
Tests · UI / test (push) Failing after 8m7s

Adds the gear-icon popover on the map view with per-game persistence
of every category toggle plus the wrap-mode radio. Hide-by-id and
visibility-fog facilities land on the renderer so every flip applies
within one frame without a Pixi remount; the wrap-mode toggle keeps
its existing remount + camera-preserve path. A new server-side turn
force-resets every flag to defaults so a hidden category never makes
the player miss the next turn's news.

Also fixes the FligthDistance → FlightDistance typo in pkg/calc/race.go
(plus the single Go caller); the TS side keeps duplicating the formula
until a race-level WASM bridge lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-19 21:33:53 +02:00
parent 65c0fbb87d
commit 2bd1b54936
32 changed files with 3046 additions and 63 deletions
+21
View File
@@ -33,6 +33,27 @@ export function torusShortestDelta(a: number, b: number, size: number): number {
return d + 0;
}
// torusShortestDistance returns the wrap-aware Euclidean distance
// between (ax, ay) and (bx, by) on a torus of size width × height.
// Built on top of `torusShortestDelta` so the two axes share the
// "shortest signed delta" semantics. Used by the Phase 29 reach
// filter (hide planets beyond `FlightDistance` of every LOCAL
// planet); both modes (torus / no-wrap) consume the same metric — in
// no-wrap mode the wrapped distance is never shorter than the
// straight-line one because the player cannot fly across the seam.
export function torusShortestDistance(
ax: number,
ay: number,
bx: number,
by: number,
width: number,
height: number,
): number {
const dx = torusShortestDelta(ax, bx, width);
const dy = torusShortestDelta(ay, by, height);
return Math.hypot(dx, dy);
}
// distSqPointToSegment returns the squared distance from point (px,py)
// to the segment (ax,ay)(bx,by). For zero-length segments it falls
// back to point-to-point distance.