This PR adds an optional pixel radius when requesting features at/near a pixel location. Previously, feature selection only returned a feature at the exact pixel location provided, but there are common use cases where a larger radius is useful, such as:
Mobile devices where input is not always so precise
Features such as thin lines may be difficult to select
The following methods are affected:
Direct scene interface:
scene.getFeatureAt(pixel, { radius })
Leaflet layer interface for setting selection handlers
In all cases, radius or selectionRadius is an optional value in pixels (default matches existing behavior, where radius is zero). When using a radius, the feature closest to the center point will be returned. (As with existing feature selection, only features marked as interactive: true will register.)
This PR adds an optional pixel radius when requesting features at/near a pixel location. Previously, feature selection only returned a feature at the exact pixel location provided, but there are common use cases where a larger radius is useful, such as:
The following methods are affected:
scene.getFeatureAt(pixel, { radius })
layer.setSelectionEvents (events, { radius })
In all cases,
radius
orselectionRadius
is an optional value in pixels (default matches existing behavior, where radius is zero). When using a radius, the feature closest to the center point will be returned. (As with existing feature selection, only features marked asinteractive: true
will register.)