You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
featuresAt with radius 0/not defined only returns Polygons #902
The above two functions (lineContainsPoint, pointContainsPoint) leave absolutely zero tolerance for what seem to be imperfect computations (see #874 — it's impossible to mouse over a Point or LineString and see a result). Should we add a tiny bit of tolerance (i.e. change this line to
if(distToSegmentSquared(p,v,w)<(r||1))returntrue;
and similarly in the point calculation)? Or is that…cheating? @jfirebaugh
Well radius is supposed to provide that tolerance, right?
I suppose so, yes, but it's weird that it's only possible to find Polygon features without providing a radius. It's not even that it's very hard to click on an exact LineString/Point; it's literally impossible to do so because of these calculations. The assumption would be that with radius: 0 you should be able to find a feature on exact click/hover.
maybe even a Math.floor would be an ok answer here — I've logged the calculations at least from lineContainsPoint and when mousing over a line I've been able to log something like 0.16
Activity
lbud commentedon Dec 20, 2014
https://github.com/mapbox/mapbox-gl-js/blob/mb-pages/js/data/feature_tree.js#L103-L116
https://github.com/mapbox/mapbox-gl-js/blob/mb-pages/js/data/feature_tree.js#L136-L145
lbud commentedon Jan 7, 2015
The above two functions (
lineContainsPoint,pointContainsPoint) leave absolutely zero tolerance for what seem to be imperfect computations (see #874 — it's impossible to mouse over a Point or LineString and see a result). Should we add a tiny bit of tolerance (i.e. change this line toand similarly in the point calculation)? Or is that…cheating?
@jfirebaugh
jfirebaugh commentedon Jan 7, 2015
Well
radiusis supposed to provide that tolerance, right?See #316 for relevant discussion -- for many/most uses cases of featuresAt, I think what we really want is paint-property-aware hit testing.
lbud commentedon Jan 7, 2015
I suppose so, yes, but it's weird that it's only possible to find Polygon features without providing a
radius. It's not even that it's very hard to click on an exact LineString/Point; it's literally impossible to do so because of these calculations. The assumption would be that withradius: 0you should be able to find a feature on exact click/hover.lbud commentedon Jan 8, 2015
maybe even a
Math.floorwould be an ok answer here — I've logged the calculations at least fromlineContainsPointand when mousing over a line I've been able to log something like 0.16Use radius param in featuresAt example for clarity. Refs #902 and #874.