Files
gods-eye-view/src/camera.js
T
Sameh Khamis 639e92b4f7 feat(app): the globe opens at planet level
The camera starts with the whole Earth in view, looking straight down,
instead of flying in to Austin. A shared link flies on from there. A
different start, a city for instance, is set with the startView option
of createApplicationControls. The Cesium renderer and the test stub now
start from the same pose, so state that carries over from the first
frames (screen clusters, marker selection, label placement) no longer
depends on which of them drew it.
2026-11-12 19:05:44 -08:00

30 lines
808 B
JavaScript

import { toRadians } from './geo/index.js';
import { cameraOf } from './render/rendererOf.js';
/**
* The view the renderer starts from: the whole planet, looking straight
* down, centred where Cesium's default view rectangle is.
*/
export const START_VIEW = Object.freeze({
lon: -82.5,
lat: 35,
height: 23000000,
});
/**
* Put the camera at a start view without a flight. A host may pass a city
* (`{ lon, lat, height, heading?, pitch? }`, angles in degrees) instead of
* the planet.
*/
export function applyStartView(viewer, view = START_VIEW) {
const { lon, lat, height, heading = 0, pitch = -90 } = view;
cameraOf(viewer).setView({
destination: { lon, lat, height },
orientation: {
heading: toRadians(heading),
pitch: toRadians(pitch),
roll: 0,
},
});
}