fix(ui): F8-12 — settle e2e regressions from the polish PR (#55)
Tests · UI / test (push) Has been cancelled
Tests · UI / test (pull_request) Successful in 3m25s

* state-binding.ts: normalise planet size by the engine's typical
  mid-range (`SIZE_NORMALIZER = 100`) so legacy fixtures recording
  Size in the hundreds do not blow up the world-unit disc and start
  overlapping neighbouring planets. The cube-root growth stays;
  Size-800 reads twice as big as Size-100.
* cargo-routes.spec.ts: retire the selection-ring CirclePrim from
  the expected primitive count (4 planets + 3 cargo arrow lines = 7).
* map-toggles.spec.ts: bombing-rings → planet outlines (the high-bit
  0xc… range is permanently empty); planet-names persist test waits
  for the renderer's debug providers and for the IndexedDB write to
  flush before reload.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-28 00:14:14 +02:00
parent 680ebac919
commit 75a4211373
3 changed files with 38 additions and 17 deletions
+15 -8
View File
@@ -39,15 +39,21 @@ import {
// extra lookup.
/**
* KNOWN_PLANET_BASE_RADIUS_WORLD is the world-unit scale of the cube-
* root size mapping for planets with a known `size`. With α = 0.33
* the on-screen pixel radius at default zoom is roughly
* `BASE * cbrt(size) * scaleRef`. The cube root keeps planet area
* proportional to volume, so a Size-8 planet reads twice as big as a
* Size-1 one. Owner can tune this together with `PLANET_SIZE_ZOOM_ALPHA`
* during the F8 manual-QA loop.
* KNOWN_PLANET_BASE_RADIUS_WORLD calibrates the cube-root size
* mapping so that an "average" planet (`size === SIZE_NORMALIZER`)
* renders at roughly this radius in world units when the camera is
* at the reference scale. Larger / smaller planets scale by
* `cbrt(size / SIZE_NORMALIZER)`, which keeps disc area proportional
* to volume — a Size-800 planet reads twice as big as a Size-100 one,
* eight times its volume but only 2× the radius.
*
* `SIZE_NORMALIZER` follows the engine's typical mid-range. Without
* it, the raw cube-root grows huge for legacy fixtures that record
* Size in hundreds; with it, the disc stays in a sane world-unit
* band so neighbouring planets never overlap on the default zoom.
*/
const KNOWN_PLANET_BASE_RADIUS_WORLD = 4;
const SIZE_NORMALIZER = 100;
/**
* UNKNOWN_PLANET_PIXEL_RADIUS matches issue #55 / п.28: planets with
@@ -62,7 +68,8 @@ function styleFor(planet: ReportPlanet, theme: Theme): Style {
if (planet.kind === "unidentified" || size === null || !(size > 0)) {
return { ...fill, pointRadiusPx: UNKNOWN_PLANET_PIXEL_RADIUS };
}
const baseRadius = KNOWN_PLANET_BASE_RADIUS_WORLD * Math.cbrt(size);
const baseRadius =
KNOWN_PLANET_BASE_RADIUS_WORLD * Math.cbrt(size / SIZE_NORMALIZER);
return { ...fill, pointRadiusWorld: baseRadius };
}