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).
|
||||
|
||||
+45
-1
@@ -806,7 +806,51 @@ Directory-промоушен ([Раздел 5](#5-реестр-названий-
|
||||
каталоге, расширить `CHECK`-констрейнт миграции и вызвать
|
||||
`notification.Submit` из подходящего доменного модуля).
|
||||
|
||||
### 6.7 Перекрёстные ссылки
|
||||
### 6.7 Управление видимостью карты
|
||||
|
||||
Карта (`ui/frontend/src/lib/active-view/map.svelte`) несёт
|
||||
попап-«шестерёнку» (`map-toggles.svelte`) в правом верхнем углу
|
||||
канваса — посекторный интерфейс видимости для конкретной игры.
|
||||
Попап содержит три группы элементов; любое изменение применяется
|
||||
в пределах одного кадра (без перемонтирования Pixi):
|
||||
|
||||
- **Объекты** — шесть независимых чекбоксов: группы в
|
||||
гиперпространстве, входящие группы, неопознанные группы,
|
||||
грузовые маршруты, метки сражений, метки бомбардировок.
|
||||
- **Планеты** — четыре строки: чужие / необитаемые /
|
||||
неопознанные виды планет плюс выключатель «показывать
|
||||
недостижимые планеты», который при выключении прячет каждую
|
||||
не-LOCAL планету, отстоящую дальше
|
||||
`FlightDistance(localPlayerDrive)` от любой LOCAL-планеты
|
||||
(метрика учитывает торическую развёртку).
|
||||
- **Вид** — переключатель тумана видимости (чуть более светлая
|
||||
заливка вне объединения окружностей
|
||||
`VisibilityDistance(localPlayerDrive)` вокруг LOCAL-планет;
|
||||
LOCAL-планеты всегда вне фильтра) плюс радиогруппа
|
||||
«торус / без переноса», переключающая режим рендерера с
|
||||
сохранением центра камеры.
|
||||
|
||||
LOCAL-планеты отрисовываются всегда — для них тоггла нет.
|
||||
Остальные тогглы по умолчанию включены. Скрытие планеты
|
||||
каскадно прячет все привязанные к ней примитивы: метки сражений
|
||||
и бомбардировок на этой планете, точки in-space и incoming
|
||||
ship-групп вместе с траекториями, летящих *к* этой планете, и
|
||||
грузовые стрелки, чей источник или назначение — эта планета.
|
||||
Каскад не оставляет на карте «осиротевших» меток, указывающих
|
||||
в пустоту.
|
||||
|
||||
Состояние видимости сохраняется по игре в namespace кеша
|
||||
`game-map-toggles/{gameId}` (см.
|
||||
[`ui/docs/storage.md`](../ui/docs/storage.md)). При каждом
|
||||
новом серверном ходе, ставшем текущим — либо через `setGame`,
|
||||
обнаруживший `currentTurn` сервера выше последнего сохранённого
|
||||
`lastResetTurn`, либо при явном клике пользователя по
|
||||
аффордансу «новый ход» — все тогглы принудительно
|
||||
сбрасываются в дефолт, чтобы новое содержимое хода не оказалось
|
||||
скрытым устаревшими настройками. Навигация по истории
|
||||
(`viewTurn`) общее состояние тогглов не сбрасывает.
|
||||
|
||||
### 6.8 Перекрёстные ссылки
|
||||
|
||||
- Backend ↔ engine wire-контракт (`pkg/model/{order,report,rest}`):
|
||||
[ARCHITECTURE.md §9](ARCHITECTURE.md#9-backend--game-engine-communication).
|
||||
|
||||
Reference in New Issue
Block a user