Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

featuresAt with radius 0/not defined only returns Polygons #902

Closed
lbud opened this issue Dec 20, 2014 · 5 comments · Fixed by #2052
Closed

featuresAt with radius 0/not defined only returns Polygons #902

lbud opened this issue Dec 20, 2014 · 5 comments · Fixed by #2052
Labels

Comments

@lbud
Copy link
Contributor

lbud commented Dec 20, 2014

…bug?
Can only find LineString/Points if radius >= 1.

@lbud
Copy link
Contributor Author

lbud commented 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 to

    if (distToSegmentSquared(p, v, w) < (r || 1)) return true;

and similarly in the point calculation)? Or is that…cheating?
@jfirebaugh

@jfirebaugh
Copy link
Contributor

Well radius is 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
Copy link
Contributor Author

lbud commented Jan 7, 2015

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.

@lbud
Copy link
Contributor Author

lbud commented Jan 8, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants