Name the real gate altitude and repaint coverage rows at once

The Transit prompt said "Fly below 3,000 km", but the closed gate opens at
2,850 km; it now names the enter threshold, as Bike Share does. When the
camera changes coverage, Transit and Bike Share ask the Layers panel to
repaint instead of leaving the old prompt up until the next 15 s / 60 s tick.
This commit is contained in:
German Khokhlov committed 2026-11-05 21:21:03 +04:00
1 parent 25c33893f6
commit 90db4eb2c9
13 files changed
+233 -7

No files matched your search

+9
View File
@@ -14,6 +14,15 @@ export function createControls({ state: layerState, services, parts, source }) {
updateInterval: STATUS_POLL_MS,
/**
* Keep the manager so camera-driven coverage changes can repaint the row
* before the next status poll.
* @param {object} dataManager DataLayerManager instance.
*/
attachDataManager(dataManager) {
layerState._dataManager = dataManager;
},
/**
* Return a sampled array of detectable station objects for HUD overlay rendering.
* @param {Object} [options] - Sampling options (maxCount, seed).
+1
View File
@@ -169,6 +169,7 @@ export function createLifecycle({
viewer.scene.primitives.remove(layerState._pointCollection);
layerState._pointCollection = null;
}
layerState._dataManager = null;
layerState._viewer = null;
},
};
+4
View File
@@ -19,6 +19,10 @@ export function createState({ services }) {
layerState._viewer = null;
/** @type {{ refreshLayerStats?: () => void }|null} Manager that repaints the layer's row. */
layerState._dataManager = null;
/** @type {Cesium.PointPrimitiveCollection|null} Primitive collection for station dots. */
layerState._pointCollection = null;
+17
View File
@@ -116,6 +116,14 @@ export function createViewport({ state: layerState, services, parts, source }) {
parts.rendering.removeCityPoints(cityId);
}
/**
* Repaint the layer's row now. Its text follows the camera (coverage
* prompt, station count), and the manager tick is 60 s.
*/
function refreshRow() {
layerState._dataManager?.refreshLayerStats?.();
}
/** Deactivate all currently active cities and clear the active set. */
function deactivateAllCities() {
@@ -205,9 +213,11 @@ export function createViewport({ state: layerState, services, parts, source }) {
const generation = ++layerState._proximityGeneration;
const altitude = getCameraAltitude(layerState._viewer);
const wasGateEnabled = layerState._altitudeGateEnabled;
// Altitude gate: disable all cities when camera is too high
if (!shouldActivateAtAltitude(altitude)) {
deactivateAllCities();
if (wasGateEnabled) refreshRow();
return;
}
@@ -226,12 +236,18 @@ export function createViewport({ state: layerState, services, parts, source }) {
if (!nextActive.has(cityId)) layerState._failedCityIds.delete(cityId);
}
const changed =
!wasGateEnabled ||
nextActive.size !== layerState._activeCityIds.size ||
[...nextActive].some((cityId) => !layerState._activeCityIds.has(cityId));
layerState._activeCityIds = nextActive;
if (layerState._activeCityIds.size === 0) {
layerState._count = 0;
layerState._lastUpdate = null;
if (changed) refreshRow();
return;
}
if (changed) refreshRow();
// Only activate cities that don't already have rendered points
const toActivate = [];
@@ -243,6 +259,7 @@ export function createViewport({ state: layerState, services, parts, source }) {
await Promise.all(
toActivate.map((cityId) => activateCity(cityId, generation)),
);
if (generation === layerState._proximityGeneration) refreshRow();
}
/** Schedule a debounced proximity check after camera movement. */