fix(street-level): a click picks in a 9 px window, so a thin line is hit a few pixels off

Coverage lines are 2.5 px wide and there is no hover cue any more: with the
default 3 px pick window a click just beside a line selected nothing.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
German KhokhlovandClaude Fable 5.1 committed 2026-10-13 13:53:54 +04:00
1 parent 361f1c0fb8
commit e2f9952867
2 files changed
+12 -2

No files matched your search

+6
View File
@@ -13,6 +13,12 @@ export const MAPILLARY_SOURCE_METHODS = Object.freeze([
'getSequenceImages',
]);
/**
* The pixel window a click picks in: coverage lines are 2.5 px wide and there
* is no hover cue, so a click a few pixels off still finds the line.
*/
export const CLICK_PICK_WINDOW_PX = 9;
/** Pick id of the viewer position marker. */
export const POSITION_PICK_ID = 'sl:pos';
+6 -2
View File
@@ -1,5 +1,5 @@
import * as Cesium from 'cesium';
import { STREET_LEVEL_LAYER_ID } from './policy.js';
import { CLICK_PICK_WINDOW_PX, STREET_LEVEL_LAYER_ID } from './policy.js';
/** One click handler for every provider's lines and cones, and the marker. */
export function createSelection({ state, parts }) {
@@ -10,7 +10,11 @@ export function createSelection({ state, parts }) {
const viewer = state.viewer;
if (!viewer || !state.enabled) return;
if (input?.isPointerFree && !input.isPointerFree()) return;
const picked = viewer.scene.pick(click.position);
const picked = viewer.scene.pick(
click.position,
CLICK_PICK_WINDOW_PX,
CLICK_PICK_WINDOW_PX,
);
const id = picking?.resolvePickId
? picking.resolvePickId(picked)
: picked?.id;