mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(voice): point-and-ask over a Street Level coverage line names its sequence again
The coverage lines were one primitive per sequence, picked as the sequence's id. Drawn in parts, a part after the first carries its own #n id, which point-and-ask passed on. A hit whose item names the id its parts pick as (meta.pick) resolves as that id, as the line's click already does.
This commit is contained in:
1 parent
d2e161372c
commit
805c9b5ccd
2 files changed
+15
-1
No files matched your search
@@ -97,7 +97,11 @@ export function resolvePickedContext(picked, { dataManager = null } = {}) {
|
||||
const record = contextCarrierRecord(picked, dataManager);
|
||||
if (record) return fromRecord(record);
|
||||
|
||||
const pickId = resolvePickId(picked);
|
||||
// An item drawn in parts names the id its parts pick as (`meta.pick`:
|
||||
// a Street Level sequence), as the one primitive they were picked as.
|
||||
const pickId =
|
||||
(typeof picked.meta?.pick === 'string' && picked.meta.pick) ||
|
||||
resolvePickId(picked);
|
||||
if (!pickId) return null;
|
||||
const layerId = findPickOwner(pickId);
|
||||
if (!layerId || IGNORED_OWNERS.has(layerId)) return null;
|
||||
|
||||
@@ -76,6 +76,16 @@ test('something drawn outside the draw port resolves through its pick owner', ()
|
||||
unregisterPickOwner('flights');
|
||||
});
|
||||
|
||||
test('a part of an item drawn in parts resolves as the id its parts pick as', () => {
|
||||
registerPickOwner('flights', (id) => String(id).startsWith('seq:'));
|
||||
const out = resolvePickedContext(
|
||||
{ set: 'lines:1', id: 'seq:42#2', meta: { pick: 'seq:42' }, surface: false },
|
||||
{ dataManager: manager() },
|
||||
);
|
||||
assert.equal(out?.id, 'seq:42', 'never the part’s own #n id');
|
||||
unregisterPickOwner('flights');
|
||||
});
|
||||
|
||||
test('disabled layers, trails and empty picks never resolve', () => {
|
||||
registerPickOwner('military', (id) => id === 'm1');
|
||||
const hit = (id) => ({ set: 'x:1', id, surface: false });
|
||||
|
||||
Reference in new issue
Block a user