mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Load the Cesium SDK from index.html again, since engine-neutral modules read its global when they load
This reverts ae13a56f. In the production build every 'cesium' import is the global that Cesium.js defines; with the script loaded only when a Cesium globe started, modules evaluated at boot (cesiumConstants, annotationEngine) threw ReferenceError and neither engine started. A cold Navara start loading Cesium.js stays a known gap.
This commit is contained in:
1 parent
9cc108835e
commit
125fbc5a3b
27 files changed
+125
-275
No files matched your search
@@ -68,7 +68,7 @@ export function createReticleFootprint() {
|
||||
const pixels = Array.from({ length: 25 }, () => geo.cartesian2.create());
|
||||
const hits = Array.from({ length: 25 }, () => geo.cartesian3.create());
|
||||
const carto = geo.cartographic.create();
|
||||
let ray;
|
||||
const ray = new Cesium.Ray();
|
||||
return (viewer, altitude, engine) => {
|
||||
const camera = engine?.camera ?? viewer?.camera;
|
||||
if (!camera?.getPickRay && !camera?.pickRay) return null;
|
||||
@@ -91,9 +91,7 @@ export function createReticleFootprint() {
|
||||
p = pixels[i];
|
||||
p.x = left + (side * col) / 4;
|
||||
p.y = top + (side * row) / 4;
|
||||
const hit = engine
|
||||
? camera.pickEllipsoid(p)
|
||||
: camera.pickEllipsoid(p, Cesium.Ellipsoid.WGS84, hits[i]);
|
||||
const hit = camera.pickEllipsoid(p, Cesium.Ellipsoid.WGS84, hits[i]);
|
||||
let dx, dy;
|
||||
if (hit) {
|
||||
geo.cartographic.fromCartesian(hit, geo.ellipsoid.WGS84, carto);
|
||||
@@ -104,7 +102,7 @@ export function createReticleFootprint() {
|
||||
} else {
|
||||
const picked = engine
|
||||
? camera.pickRay(p)
|
||||
: camera.getPickRay(p, (ray ??= new Cesium.Ray())) || ray;
|
||||
: camera.getPickRay(p, ray) || ray;
|
||||
if (!picked) continue;
|
||||
const d = picked.direction;
|
||||
dx =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { rgbaFromCss } from '../shared/color.js';
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
/**
|
||||
* @file Street Traffic selects TomTom, OpenMapTiles or Hybrid motor roads,
|
||||
@@ -112,9 +112,9 @@ export const SIZE_BY_TYPE = {
|
||||
*/
|
||||
|
||||
export const FLOW_BUCKET_COLORS = {
|
||||
free: rgbaFromCss('#2ecc71').withAlpha(0.9),
|
||||
slow: rgbaFromCss('#f0b23e').withAlpha(0.9),
|
||||
jam: rgbaFromCss('#e05252').withAlpha(0.9),
|
||||
free: Cesium.Color.fromCssColorString('#2ecc71').withAlpha(0.9),
|
||||
slow: Cesium.Color.fromCssColorString('#f0b23e').withAlpha(0.9),
|
||||
jam: Cesium.Color.fromCssColorString('#e05252').withAlpha(0.9),
|
||||
};
|
||||
|
||||
// ─── Jam-viz prototype (live mode only — see 2026-07-21 design doc) ────────
|
||||
@@ -140,11 +140,12 @@ export const HEAT_JAM_PULSE_ALPHA = 0.2;
|
||||
|
||||
/** @const {Cesium.Color} Jam corridor color (bucket red, alpha pulsed live). */
|
||||
|
||||
export const HEAT_JAM_COLOR = rgbaFromCss('#e05252');
|
||||
export const HEAT_JAM_COLOR = Cesium.Color.fromCssColorString('#e05252');
|
||||
|
||||
/** @const {Cesium.Color} Slow corridor color (bucket amber, faint + static). */
|
||||
|
||||
export const HEAT_SLOW_COLOR = rgbaFromCss('#f0b23e').withAlpha(0.2);
|
||||
export const HEAT_SLOW_COLOR =
|
||||
Cesium.Color.fromCssColorString('#f0b23e').withAlpha(0.2);
|
||||
|
||||
/** @const {number} Far-distance scale floor for jam dots (shipped: 0.3). */
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ export function roadIdentity(road) {
|
||||
/** Retain one road and its dot population across tile and surface publications. */
|
||||
export function createRetention({ state, parts }) {
|
||||
const records = new Map();
|
||||
const heightStep = { x: 0, y: 0, z: 0 };
|
||||
const screenFrom = { x: 0, y: 0 };
|
||||
const screenTo = { x: 0, y: 0 };
|
||||
const eye = { x: 0, y: 0, z: 0 };
|
||||
const heightStep = new Cesium.Cartesian3();
|
||||
const screenFrom = new Cesium.Cartesian2();
|
||||
const screenTo = new Cesium.Cartesian2();
|
||||
const eye = new Cesium.Cartesian3();
|
||||
function projectSafely(scene, point, screen) {
|
||||
if (scene.project) return Boolean(scene.project(point, screen));
|
||||
if (scene.camera.viewMatrix) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { normalizeRoadMode } from './roadModes.js';
|
||||
import * as Cesium from 'cesium';
|
||||
import { FLOW_BUCKET_COLORS } from './policy.js';
|
||||
|
||||
export function createState({ services }) {
|
||||
@@ -293,7 +294,7 @@ export function createState({ services }) {
|
||||
|
||||
/** Reusable scratch Cartesian3 to avoid per-frame allocation / GC pressure */
|
||||
|
||||
layerState._scratchLerp = { x: 0, y: 0, z: 0 };
|
||||
layerState._scratchLerp = new Cesium.Cartesian3();
|
||||
|
||||
// ─── Animation ─────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in new issue
Block a user