mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(voice): the in-view scan sees News reports and Wildlife Sightings again
Voice's in-view scan projects each context record's targetPosition. News and Wildlife Sightings still set only the entity's base position, so both dropped out of "what am I looking at". They now pass it as targetPosition, as GeoJSON and FIRMS do.
This commit is contained in:
1 parent
ea3b87805a
commit
14e406002c
4 files changed
+32
-1
No files matched your search
@@ -909,6 +909,8 @@ export function createNewsLayer({
|
||||
);
|
||||
entity.__localBaseCartesian = fromDegrees(lon, lat);
|
||||
registerEntityContext(entity, {
|
||||
// Where voice's in-view scan projects it.
|
||||
targetPosition: entity.__localBaseCartesian,
|
||||
id: `news-report:${report.id}`,
|
||||
layerId: NEWS_LAYER_ID,
|
||||
layerName: 'News',
|
||||
|
||||
@@ -5,6 +5,7 @@ import { fromDegrees } from '../../geo/ellipsoid.js';
|
||||
import { bindFakeDraw } from '../../testSupport/fakeDrawPort.mjs';
|
||||
import { fakeCameraPort } from '../../testSupport/fakeCameraPort.mjs';
|
||||
import { NEWS_KEY_PROVIDERS, createNewsLayer } from './index.js';
|
||||
import { getSelectedEntityContext } from '../../data/contextStore.js';
|
||||
|
||||
const NOW = Date.parse('2026-10-28T10:00:00Z');
|
||||
const hotspotsPayload = {
|
||||
@@ -251,6 +252,17 @@ test('choosing a card selects it and flies straight down from 150 km; reduced mo
|
||||
assert.equal(layer.getRowControls().feed.selected, null);
|
||||
});
|
||||
|
||||
test('a selected report carries the point voice projects to find what is in view', async (t) => {
|
||||
const { layer } = fixture(t);
|
||||
layer.enable();
|
||||
await layer.update();
|
||||
layer.setParams({ reportId: 'major' });
|
||||
const record = getSelectedEntityContext();
|
||||
assert.equal(record?.id, 'news-report:major');
|
||||
assert.ok(record.targetPosition, 'a position voice can project');
|
||||
assert.equal(record.targetPosition, record.entity.__localBaseCartesian);
|
||||
});
|
||||
|
||||
test('the severity floor changes what is shown, not what is read', async (t) => {
|
||||
const { layer, entries, calls } = fixture(t, { height: 500_000 });
|
||||
layer.enable();
|
||||
|
||||
@@ -338,6 +338,8 @@ export function createSelection({ state, services, parts }) {
|
||||
// i18n-ignore: provider names and feed-supplied organism names are verbatim
|
||||
const label = `${name} · ${row.origin === 'acartia' ? 'Acartia' : 'iNaturalist'}`;
|
||||
services.context.registerEntityContext(carrier, {
|
||||
// Where voice's in-view scan projects it.
|
||||
targetPosition: carrier.__localBaseCartesian,
|
||||
id: row.stableId,
|
||||
layerId: 'wildlife-sightings',
|
||||
layerName: t('Wildlife Sightings'),
|
||||
|
||||
@@ -14,7 +14,7 @@ const row = {
|
||||
link: 'https://www.inaturalist.org/observations/123',
|
||||
};
|
||||
|
||||
function fixture(sighting = row) {
|
||||
function fixture(sighting = row, extraServices = {}) {
|
||||
const position = { x: 300, y: 300, z: 0 };
|
||||
const entries = new Map();
|
||||
const flights = [];
|
||||
@@ -65,6 +65,7 @@ function fixture(sighting = row) {
|
||||
},
|
||||
}),
|
||||
eventTarget: new EventTarget(),
|
||||
...extraServices,
|
||||
},
|
||||
parts: {
|
||||
rendering: {
|
||||
@@ -298,3 +299,17 @@ test('empty clicks and layer removal release the selected row and its overlay',
|
||||
assert.equal(f.seen.at(-1).value, null);
|
||||
assert.equal(f.entries.size, 0);
|
||||
});
|
||||
|
||||
test('each sighting in context carries the point voice projects to find what is in view', () => {
|
||||
const registered = [];
|
||||
const f = fixture(row, {
|
||||
context: {
|
||||
registerEntityContext: (entity, metadata) =>
|
||||
registered.push({ entity, metadata }),
|
||||
},
|
||||
});
|
||||
f.selection.refreshContexts();
|
||||
assert.equal(registered.length, 1);
|
||||
assert.equal(registered[0].metadata.id, row.stableId);
|
||||
assert.equal(registered[0].metadata.targetPosition, f.position);
|
||||
});
|
||||
Reference in new issue
Block a user