mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
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:
1 parent
2e18673df8
commit
81fe7f88cc
26 files changed
+1608
-638
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { fromDegrees } from '../../geo/ellipsoid.js';
|
||||
import { distance, dot } from '../../geo/vector.js';
|
||||
import { canvasOf, findCamera } from '../../render/rendererOf.js';
|
||||
import { canvasOf, findCamera, findGlobe } from '../../render/rendererOf.js';
|
||||
import { viewshedColors, cameraHue } from '../../data/cctvViewshed.js';
|
||||
import { CCTV_OVERLAY_SOURCE_ID } from '../../data/cctvCards.js';
|
||||
import { GIZMO_ID_PREFIX } from '../../data/cctvGizmo.js';
|
||||
@@ -103,6 +103,30 @@ export function createLifecycle({
|
||||
* listeners to its camera; one against the same viewer keeps them.
|
||||
*/
|
||||
function attachViewListeners() {
|
||||
const globe = findGlobe(layerState._viewer);
|
||||
if (layerState._surfaceListenerGlobe !== globe) {
|
||||
layerState._surfaceListener?.();
|
||||
layerState._surfaceListener = null;
|
||||
layerState._surfaceListenerGlobe = globe;
|
||||
}
|
||||
if (!layerState._surfaceListener && globe?.on) {
|
||||
// Refresh drawn heights when terrain finishes loading or the surface changes.
|
||||
let version = globe.surfaceVersion?.();
|
||||
let terrainPending = globe.isSettled?.('terrain') === false ? 1 : 0;
|
||||
layerState._surfaceListener = globe.on('progress', (progress) => {
|
||||
const next = globe.surfaceVersion?.();
|
||||
const loaded = progress?.terrainPending === 0 && terrainPending !== 0;
|
||||
const swapped = next !== version;
|
||||
version = next;
|
||||
terrainPending = progress?.terrainPending ?? terrainPending;
|
||||
if (
|
||||
(loaded || swapped) &&
|
||||
layerState._enabled &&
|
||||
!layerState._cameraMoving
|
||||
)
|
||||
settleView();
|
||||
});
|
||||
}
|
||||
const viewCamera = findCamera(layerState._viewer);
|
||||
if (
|
||||
layerState._viewListenerCamera &&
|
||||
@@ -140,6 +164,9 @@ export function createLifecycle({
|
||||
|
||||
/** Drop the move listeners; nothing reports the end of a move after it. */
|
||||
function detachViewListeners() {
|
||||
layerState._surfaceListener?.();
|
||||
layerState._surfaceListener = null;
|
||||
layerState._surfaceListenerGlobe = null;
|
||||
layerState._horizonCullListener?.();
|
||||
layerState._horizonCullListener = null;
|
||||
layerState._moveStartListener?.();
|
||||
@@ -287,9 +314,8 @@ export function createLifecycle({
|
||||
coverageEntities: [],
|
||||
projection: null,
|
||||
// Task 5 (height-datum fix): regime-aware ground resolution state.
|
||||
// groundPrior — { ellipsoid, source } from the Re:Earth batch
|
||||
// (null until a late batch lands). The prior applies in EVERY
|
||||
// regime and is the terrain-globe resolution outright.
|
||||
// groundPrior — { ellipsoid, source } from the Re:Earth batch, or
|
||||
// drawn-terrain with its read conditions for an unanswered camera.
|
||||
// groundResolved — PER-REGIME one-shot latch (regime key →
|
||||
// boolean): true once this record's resolution completed for that
|
||||
// regime; such records are excluded from the completion pass so
|
||||
|
||||
Reference in new issue
Block a user