Load the Cesium SDK and its widget styles only when a Cesium globe first starts

This commit is contained in:
German Khokhlov committed 2026-11-03 22:56:24 +04:00
1 parent 9f8381ff71
commit ae13a56f6d
27 files changed
+269 -124

No files matched your search

+10 -5
View File
@@ -8,12 +8,12 @@
import * as Cesium from 'cesium';
import { createMoverRegistry } from '../movers.js';
const scratchPosition = new Cesium.Cartesian3();
const scratchColor = new Cesium.Color();
const scratchQuaternion = new Cesium.Quaternion();
const scratchRotation = new Cesium.Matrix3();
let scratchPosition;
let scratchColor;
let scratchQuaternion;
let scratchRotation;
// Model.modelMatrix and Model.color copy what they are given.
const scratchModelMatrix = new Cesium.Matrix4();
let scratchModelMatrix;
/** The atlas cells as canvases, by key (a DOM canvas or image source). */
async function cropAtlasCells(atlas, keys) {
@@ -287,6 +287,11 @@ export function createCesiumMovers(
viewer,
{ requestRender = () => viewer.scene.requestRender(), factories = {} } = {},
) {
scratchPosition ??= new Cesium.Cartesian3();
scratchColor ??= new Cesium.Color();
scratchQuaternion ??= new Cesium.Quaternion();
scratchRotation ??= new Cesium.Matrix3();
scratchModelMatrix ??= new Cesium.Matrix4();
const make = { ...DEFAULT_FACTORIES, ...factories };
const { scene } = viewer;
let root = null;