fix(ui): F8-10 owner-feedback — persistent filters, camera, disabled visual, dropdown narrowing (#53)
Polish pass after the first F8-10 walkthrough:
- table-planets: moved the `foreign` chip to the end of the row and
hid the race dropdown until `foreign` is on (it never made sense
to pick a race while the bucket itself was off).
- persistent per-table filter / sort state — extracted to
`table-{planets,ship-groups,fleets}-state.svelte.ts` singletons so
a row click → map → back to the table restores the prior chip /
dropdown / sort state. Held in memory only; an F5 still resets.
- table-ship-groups: the planet and class dropdowns now narrow to
the slice surviving the owner checkboxes, so toggling `foreign`
off removes planets / classes touched only by foreign rows.
- map.svelte: camera (centre + zoom) is captured on every dispose
path into a new `GameStateStore.lastCamera` and consumed on the
next mount, so leaving the map for any other active view and
coming back restores the prior pan / zoom. A pending focus from
the tables still wins for the centre point.
- table-ship-classes: `:disabled` now reads as disabled (muted
colour, no hover ring, not-allowed cursor) — the click was already
a no-op, only the visual was lying.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -467,15 +467,23 @@ preference the store already manages.
|
||||
if (canvasEl === null || containerEl === null) return;
|
||||
// Capture camera state before disposing so a remount inside
|
||||
// the same game (e.g. cargo-route overlay change) keeps the
|
||||
// user's pan/zoom. A new game / first mount has no prior
|
||||
// camera, so `previousCamera` stays null and the default
|
||||
// centring path runs.
|
||||
// user's pan / zoom. On a cold mount with no live `handle` we
|
||||
// fall back to the per-game `store.lastCamera` snapshot, so
|
||||
// leaving the map for a table / report and coming back also
|
||||
// restores the prior view. A new game / first mount has no
|
||||
// prior camera in either source, so `previousCamera` stays
|
||||
// null and the default centring path runs.
|
||||
const previousGameId = mountedGameId;
|
||||
const targetGameId = store?.gameId ?? "";
|
||||
const previousCamera =
|
||||
handle !== null && previousGameId === targetGameId
|
||||
? handle.getCamera()
|
||||
: null;
|
||||
let previousCamera: ReturnType<RendererHandle["getCamera"]> | null = null;
|
||||
if (handle !== null && previousGameId === targetGameId) {
|
||||
previousCamera = handle.getCamera();
|
||||
} else if (handle === null && store?.lastCamera) {
|
||||
previousCamera = store.lastCamera;
|
||||
}
|
||||
if (handle !== null && store !== undefined) {
|
||||
store.lastCamera = handle.getCamera();
|
||||
}
|
||||
if (detachClick !== null) {
|
||||
detachClick();
|
||||
detachClick = null;
|
||||
@@ -809,6 +817,9 @@ preference the store already manages.
|
||||
detachDebugSurface = null;
|
||||
}
|
||||
if (handle !== null) {
|
||||
// Persist the camera snapshot to the per-game store so the
|
||||
// next mount (active-view switch back to map) restores it.
|
||||
if (store !== undefined) store.lastCamera = handle.getCamera();
|
||||
handle.dispose();
|
||||
handle = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user