mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Read the navigation and point-and-ask camera through the renderer's ports
The navigation controller and the location navigation cancel flights and read the camera's place through the camera port. Point-and-ask's camera pose key and its "around here" radius read the camera port's pose; its entity pick moves into the input dispatcher (pickAt), which picks as a click does, so the follow's helper still reads as its target. navigationController, locationNavigation and pointerPick leave the Cesium allow-list. Their package entries (./ui/navigation and three voice entries) no longer load the Cesium adapter: given a viewer of a caller's own, they find its camera once the caller loads ./render/cesium/unbound. They are listed as such in the unbound camera test, which fails if one starts loading the factory again.
This commit is contained in:
1 parent
3484bfa56d
commit
a2c4d27b5a
9 files changed
+92
-35
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
toggleCameraTilt,
|
||||
} from './cameraOrientationControls.js';
|
||||
import { NavigationController } from './navigationController.js';
|
||||
import { bindRenderer } from '../render/rendererOf.js';
|
||||
import { entityRecord } from '../data/entityRecords.js';
|
||||
|
||||
function createViewer({ cameraPosition, target, pickPosition = null } = {}) {
|
||||
@@ -600,10 +601,10 @@ test('orientation animation cancels on replacement and explicit cancellation', (
|
||||
test('orientation navigation preserves follow and selection; new navigation cancels animation', () => {
|
||||
const calls = [];
|
||||
const entity = {};
|
||||
const viewer = {
|
||||
trackedEntity: entity,
|
||||
const viewer = { trackedEntity: entity };
|
||||
bindRenderer(viewer, {
|
||||
camera: { cancelFlight: () => calls.push('cancel-flight') },
|
||||
};
|
||||
});
|
||||
let cockpit = false;
|
||||
const navigation = new NavigationController({
|
||||
viewer,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { findCamera } from '../render/cesium/camera.js';
|
||||
import { findCamera } from '../render/rendererOf.js';
|
||||
import { stopFollowing } from '../data/followed.js';
|
||||
import * as Cesium from 'cesium';
|
||||
import { t } from '../i18n/index.js';
|
||||
import { createStateChannel } from '../app/stateChannel.js';
|
||||
import { LocationControls } from './location.js';
|
||||
@@ -387,15 +386,19 @@ export class LocationNavigation {
|
||||
settled = true;
|
||||
clearTimeout(timer);
|
||||
this._endWorldJumpTransition();
|
||||
const carto = this.viewer.camera.positionCartographic;
|
||||
const pose = findCamera(this.viewer)?.pose();
|
||||
const result = {
|
||||
ok: !cancelled,
|
||||
action: 'zoom_to_globe',
|
||||
cancelled,
|
||||
heightKm: Math.round(GLOBE_VIEW.heightM / 1000),
|
||||
centeredOn: {
|
||||
latitude: Number(Cesium.Math.toDegrees(carto.latitude).toFixed(2)),
|
||||
longitude: Number(Cesium.Math.toDegrees(carto.longitude).toFixed(2)),
|
||||
latitude: Number.isFinite(pose?.lat)
|
||||
? Number(pose.lat.toFixed(2))
|
||||
: null,
|
||||
longitude: Number.isFinite(pose?.lon)
|
||||
? Number(pose.lon.toFixed(2))
|
||||
: null,
|
||||
},
|
||||
};
|
||||
this._publishGlobeResetting?.(false);
|
||||
@@ -405,7 +408,7 @@ export class LocationNavigation {
|
||||
};
|
||||
this._cancelGlobeReset = () => finish(true);
|
||||
timer = window.setTimeout(() => {
|
||||
const height = this.viewer.camera.positionCartographic?.height;
|
||||
const height = findCamera(this.viewer)?.pose().height;
|
||||
finish(
|
||||
!Number.isFinite(height) ||
|
||||
Math.abs(height - GLOBE_VIEW.heightM) > 1000,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { findCamera } from '../render/cesium/camera.js';
|
||||
import { findCamera } from '../render/rendererOf.js';
|
||||
import { stopFollowing } from '../data/followed.js';
|
||||
import { cancelCameraArrival } from '../data/cameraArrival.js';
|
||||
import { createStateChannel } from '../app/stateChannel.js';
|
||||
@@ -217,7 +217,7 @@ export class NavigationController {
|
||||
release: () => {
|
||||
this.interruptCameraMotion('camera-orientation');
|
||||
this.stopOrbit();
|
||||
this.viewer.camera.cancelFlight();
|
||||
findCamera(this.viewer)?.cancelFlight();
|
||||
},
|
||||
navigate,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user