fix(globe): Navara lines are picked within 8 px of their segments

Review of Task 4: the CPU line pick (shared with the sprite drill, hover
and the synchronous pick) took half the drawn width + 3 px, so a 1-2 px
trail needed a 3.5-4 px aim. Now within 8 px of the projected segments,
or half the width + 3 px for wider lines. Tested at 7.5 and 8.5 px from
a 1 px line; the contract suite's line click passes on both engines.
This commit is contained in:
German Khokhlov committed 2026-10-16 19:05:20 +04:00
1 parent e804351205
commit 93866c42fc
2 files changed
+31 -3

No files matched your search

+23
View File
@@ -249,3 +249,26 @@ test('a GPU answer naming an instance drawn far from the click is stale', async
assert.equal((await answer).id, 'drawn-here');
assert.equal(picking.clickStats().stale, 1);
});
test('a thin line is picked within 8 px of its segments', () => {
const line = {
options: normalizeLineOptions({
id: 'trail',
widthPx: 1,
color: [1, 1, 1, 1],
pickId: 'trail-1',
}),
flat: new Float64Array([0, 50, 100, 200, 50, 100]),
modelMatrix: null,
};
const picking = createNavaraPicking({
view: fakeView(),
projector,
camera,
movers: () => [],
lines: () => [line],
resolveBatch: () => null,
});
assert.equal(picking.pick({ x: 100, y: 57.5 })?.id, 'trail-1');
assert.equal(picking.pick({ x: 100, y: 58.5 }), undefined);
});