mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
refactor(installations): use globe camera contract
This commit is contained in:
1 parent
c58bc9864b
commit
f4f0088814
6 files changed
+100
-17
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import * as geo from '../../geo/index.js';
|
||||
import { createControls } from './controls.js';
|
||||
|
||||
test('focus frames a selected installation through the globe engine camera', () => {
|
||||
const record = { id: 'osm:node:12', latitude: 70, longitude: 179.8 };
|
||||
let flight = null;
|
||||
const state = {
|
||||
engine: {
|
||||
camera: {
|
||||
flyToSphere: (sphere, options) => {
|
||||
flight = { sphere, options };
|
||||
},
|
||||
},
|
||||
},
|
||||
recordById: new Map([[record.id, record]]),
|
||||
};
|
||||
const controls = createControls({
|
||||
state,
|
||||
services: {},
|
||||
parts: {
|
||||
selection: { selectRecord: (id) => id === record.id },
|
||||
rendering: { installationSurfaceHeightM: () => 126 },
|
||||
},
|
||||
source: {},
|
||||
}).methods;
|
||||
|
||||
assert.equal(controls.focusById(record.id), true);
|
||||
assert.deepEqual(
|
||||
flight.sphere.center,
|
||||
geo.cartesian3.fromDegrees(179.8, 70, 126),
|
||||
);
|
||||
assert.equal(flight.sphere.radius, 18000);
|
||||
assert.deepEqual(flight.options, { duration: 1.4 });
|
||||
});
|
||||
Reference in new issue
Block a user