mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
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:
1 parent
361f1c0fb8
commit
e2f9952867
2 files changed
+12
-2
No files matched your search
@@ -13,6 +13,12 @@ export const MAPILLARY_SOURCE_METHODS = Object.freeze([
|
|||||||
'getSequenceImages',
|
'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. */
|
/** Pick id of the viewer position marker. */
|
||||||
export const POSITION_PICK_ID = 'sl:pos';
|
export const POSITION_PICK_ID = 'sl:pos';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as Cesium from 'cesium';
|
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. */
|
/** One click handler for every provider's lines and cones, and the marker. */
|
||||||
export function createSelection({ state, parts }) {
|
export function createSelection({ state, parts }) {
|
||||||
@@ -10,7 +10,11 @@ export function createSelection({ state, parts }) {
|
|||||||
const viewer = state.viewer;
|
const viewer = state.viewer;
|
||||||
if (!viewer || !state.enabled) return;
|
if (!viewer || !state.enabled) return;
|
||||||
if (input?.isPointerFree && !input.isPointerFree()) 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
|
const id = picking?.resolvePickId
|
||||||
? picking.resolvePickId(picked)
|
? picking.resolvePickId(picked)
|
||||||
: picked?.id;
|
: picked?.id;
|
||||||
|
|||||||
Reference in new issue
Block a user