fix(cctv): settle the review of the count markers

Bugs:
- Cameras on one mount stay side by side after their geometry is built,
  so a click or a settled view no longer folds them back into one icon.
- A count click yields to a card drawn over the marker and to another
  layer's object under it, waits while the cockpit or tracking holds the
  view, and flies at most halfway, so a long chain of cameras still splits.
- The active camera's icon is never covered by a count, transparent
  corners of the marker no longer catch clicks, and a count hidden under
  the HUD keeps its lone cameras.
- A lone camera joins only its nearest count and never bridges two; cameras
  close enough to draw as icons take part too, at their drawn icon size.
- Groups across the antimeridian keep their longitude; the flight frames
  the highest mount; markers on ground below the ellipsoid stay visible;
  counts fade outside the Scope circle.
- Mounts less than a metre apart count as one mount.
- A drawn-terrain height survives a late fallback answer, is read for an
  unresolved camera and for one projected off the window, is re-read when
  the terrain under it finishes loading or the terrain source changes, and
  the read budget no longer goes to the same misses each pass.

Cleanup: the glyph draws from one green SVG sprite instead of recolouring
pixels, marker-only constants move next to their use, layout tests check
behaviour rather than formulas, and docs and comments match the code.
docs/I18N.md names the one fixed notation of count badges as an exception.
This commit is contained in:
German Khokhlov committed 2026-11-19 03:07:04 +04:00
1 parent 2e18673df8
commit 81fe7f88cc
26 files changed
+1608 -638

No files matched your search

+21 -26
View File
@@ -1953,32 +1953,27 @@ accepts forwarding headers, so cameras work behind a reverse proxy; a forwarded
request skips the key-bearing Street View fallback and gets the placeholder.
The CCTV layer draws only the cameras on or near the screen. Zoomed out, a
ground cell containing multiple cameras shows, at their centre, a marker with
a small green camera pictogram under its top edge and the count just below its
middle. The marker grows with the count and is drawn on the world overlay at
the same resolution as camera callouts. A lone camera whose icon would sit
within 4 px of a marker is counted in that marker instead of being drawn; the
active camera always keeps its own icon. On a globe map a marker stands on
the drawn terrain under its cameras' mean position, and a click frames that
ground. A camera the terrain height batch never answered for (no prior, or
the geoid fallback a failed or rate-limited chunk leaves) takes the terrain
the globe draws under it as its ground once it is near the screen, up to 300
cameras a view pass, and reads it again from less than half as far; a batch
answer that arrives later replaces it. Without this such a camera sits near
sea level, drifts across mountain terrain as the view tilts or pans, and
never leaves its count. Cameras on one mount (the same point to about a
metre) draw side by side, 30 px apart, once they show as icons; their records
keep the mount's position.
The count includes cameras beyond the screen edge and excludes cameras beyond
the horizon. Counts that would overlap on screen merge into one that carries
their sum. Clicking a count zooms to its group. Single cameras keep their icons,
and the active camera has its own icon and is excluded from the count. Close
up, even co-located cameras show individually. Ambient cards and coverage
attach to individual cameras. Ground placement has at most two attempts per
camera and view regime. The view pass reruns while the camera moves, paced by
its own cost. The camera picker lists the active camera first, keeps one
representative per visible cell, preferring healthy feeds, and closes with
the count of cameras outside the view.
ground cell with two or more cameras shows one marker at their mean position. A
green camera pictogram sits under its top edge and the count just below its
middle. The marker grows with the count and paints on the world overlay at
callout resolution. The count covers the whole cell up to the horizon, including
its off-screen cameras. Overlapping markers merge and add their counts. A lone
camera whose icon would touch a marker joins the nearest one, unless the HUD
hides that marker. The active camera keeps its own icon beside any marker that
would cover it and stays out of the count. A click on a marker zooms in on its
group, at least halving the distance each time. The view stays put while the
cockpit or a tracked object holds it. Ambient cards and coverage attach only to
cameras drawn as icons. On a globe map a marker stands on the drawn terrain. A
camera the height batch never answered for takes the drawn terrain as its ground
once it is near the screen. It reads that height again from much closer, once
the terrain in view has loaded, or when the terrain source changes. A later
Re:Earth answer replaces it. A fallback preserves it. Close up every camera
shows. Cameras on one mount draw side by side and their records keep the mount.
Ground placement has at most two attempts per camera and view regime. The view
pass reruns while the camera moves, paced by its own cost, and when the terrain
in view finishes loading. The camera picker lists the active camera first, then
one camera per visible cell, preferring healthy feeds. It ends with the count of
catalog cameras missing from the list.
Traffic owns its rendered-surface observer only while enabled, removes it on disable/destroy, and rebuilds no cached heights on frames where the surface identity is unchanged. Its dots and heat-lines are two renderer draw sets, it animates on the frame port's preRender, and it follows the camera through the camera port at its own 5% threshold rather than the shared `percentageChanged` ledger. The surface identity is the globe port's `surfaceVersion()` and tile readiness its `isSettled('surface')`, so the layer no longer reaches Cesium. Heat-lines are always asked for draped: where the Cesium renderer cannot drape (no depth textures) its draw port draws them (and every other draped line) over the surface, in their colour where the surface hides them and hidden past the horizon, recolouring a line in place when only its colour changes, rather than the layer dropping them.
+1
View File
@@ -107,6 +107,7 @@ Call it before views render. `onLocaleChange` listeners word their text again at
- **Translate the label, not the value.** Layer ids, enums, share-link parameters, API fields, voice tool schemas and feed data (callsigns, vessel and place names) stay as they are; translate only the text shown for them.
- **No `t()` at module top level.** Keep the English in `msg()` and call `t()` when rendering.
- **Numbers and dates** go through `formatNumber`, `formatDate`, `formatRelativeTime` and `formatUtcDayMonth` from `src/i18n/index.js`, which follow the active language.
Compact CCTV count badges painted on the map use Latin digits, a decimal point and a `K` suffix for thousands (`999`, `1.7K`, `12K`). Each badge keeps its width and reads the same across locales. Format these badges only with `formatCameraCount` in `src/data/cctvCellCounts.js`.
- **Identical English means identical translation,** unless you give it a context: `t('CLEAR', { context: 'action' })` (a button) is its own catalog entry, `action|CLEAR`, while `t('CLEAR')` (the sky) stays separate. English output is the same.
- **Text that should stay English** (a brand, a code, a unit symbol) is simply not wrapped.