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:
Sameh Khamis committed 2026-11-14 00:23:36 -08:00
1 parent ea3b87805a
commit 14e406002c
4 files changed
+32 -1

No files matched your search

@@ -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);
});