feat(ui): Phase 29 map visibility toggles
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:
+43
-1
@@ -786,7 +786,49 @@ producer; adding one is purely additive (register the kind in the
|
||||
catalog, extend the migration `CHECK` constraint, and call
|
||||
`notification.Submit` from the appropriate domain module).
|
||||
|
||||
### 6.7 Cross-references
|
||||
### 6.7 Map visibility controls
|
||||
|
||||
The map view (`ui/frontend/src/lib/active-view/map.svelte`)
|
||||
carries a gear-icon popover (`map-toggles.svelte`) in the
|
||||
canvas's top-right corner, providing the player with a per-game
|
||||
visibility surface. The popover lists three groups of controls;
|
||||
every change applies within one frame (no Pixi remount):
|
||||
|
||||
- **Objects** — six independent checkboxes: hyperspace groups,
|
||||
incoming groups, unidentified groups, cargo routes, battle
|
||||
markers, bombing markers.
|
||||
- **Planets** — four rows: foreign / uninhabited / unidentified
|
||||
planet kinds plus a "show unreachable planets" switch that, when
|
||||
off, hides every non-LOCAL planet that sits beyond
|
||||
`FlightDistance(localPlayerDrive)` of every LOCAL planet
|
||||
(torus-aware metric).
|
||||
- **View** — visibility fog toggle (slightly lighter overlay
|
||||
outside the union of `VisibilityDistance(localPlayerDrive)`
|
||||
circles around LOCAL planets; LOCAL planets are always
|
||||
exempt) plus the torus / no-wrap radio that switches the
|
||||
renderer mode while preserving the camera centre.
|
||||
|
||||
LOCAL planets are always rendered — they have no toggle. Every
|
||||
other toggle defaults to ON. Hiding a planet cascades onto every
|
||||
primitive anchored on it: battle and bombing markers on the
|
||||
planet, in-space and incoming ship-group points plus their
|
||||
trajectory lines flying *to* the planet, and cargo-route arrows
|
||||
whose source or destination is that planet. The cascade keeps
|
||||
the map free of orphan glyphs pointing at empty space.
|
||||
|
||||
Visibility state persists per game in the
|
||||
`game-map-toggles/{gameId}` cache namespace (see
|
||||
[`ui/docs/storage.md`](../ui/docs/storage.md)). Whenever a new
|
||||
server-side turn becomes the player's current turn — either via
|
||||
`setGame` opening the player on a server `currentTurn` greater
|
||||
than the last persisted `lastResetTurn`, or via the user
|
||||
explicitly clicking the pending-turn affordance — every toggle
|
||||
is force-reset to defaults so the new turn's content cannot be
|
||||
silently hidden by a stale preference. History-mode navigation
|
||||
(`viewTurn`) keeps the shared toggle state intact across past
|
||||
turns.
|
||||
|
||||
### 6.8 Cross-references
|
||||
|
||||
- Backend ↔ engine wire contract (`pkg/model/{order,report,rest}`):
|
||||
[ARCHITECTURE.md §9](ARCHITECTURE.md#9-backend--game-engine-communication).
|
||||
|
||||
Reference in New Issue
Block a user