mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
fix(wildlife): a tap selects only a sighting exactly under it again
A click read the scene's exact pick at the tap. Through the input dispatcher it read the click's id, which on a touch screen comes from the wider contact search: a tap near a sighting selected it, and one near another layer's contact kept the selection. It reads the exact top hit again, as the shipwrecks and Local ADS-B layers do.
This commit is contained in:
1 parent
cbc0c114eb
commit
4f24b9a062
3 files changed
+28
-5
No files matched your search
@@ -99,9 +99,13 @@ function fixture(sighting = row, extraServices = {}) {
|
||||
for (const id of ids) painted.add(id);
|
||||
selection.photoCardsChanged();
|
||||
},
|
||||
click(id = `wildlife:${sighting.stableId}`) {
|
||||
// The input dispatcher hands the pick's registry-resolved id.
|
||||
click({ screenPosition: { x: 10, y: 20 }, id: id ?? undefined });
|
||||
click(id = `wildlife:${sighting.stableId}`, { touchId } = {}) {
|
||||
// The exact top hit, and the id a touch's wider contact search finds.
|
||||
click({
|
||||
screenPosition: { x: 10, y: 20 },
|
||||
topHit: id ? { set: 'wildlife', id } : null,
|
||||
id: touchId ?? id ?? undefined,
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -300,6 +304,17 @@ test('empty clicks and layer removal release the selected row and its overlay',
|
||||
assert.equal(f.entries.size, 0);
|
||||
});
|
||||
|
||||
test('a tap selects only a sighting exactly under it, not one the touch search found near it', () => {
|
||||
const f = fixture();
|
||||
f.selection.install();
|
||||
f.click(null, { touchId: `wildlife:${row.stableId}` });
|
||||
assert.equal(f.state.selectedId, null);
|
||||
f.click();
|
||||
assert.ok(f.state.selectedId);
|
||||
f.click(null, { touchId: 'other:aircraft' });
|
||||
assert.equal(f.state.selectedId, null, 'a tap near another contact clears');
|
||||
});
|
||||
|
||||
test('each sighting in context carries the point voice projects to find what is in view', () => {
|
||||
const registered = [];
|
||||
const f = fixture(row, {
|
||||
|
||||
Reference in new issue
Block a user