mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
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 },
|
|
model: { 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 });
|
|
});
|