Skip to content

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

Closed

Description

@lbud

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

Activity

  1. lbud commented on Jan 7, 2015

    @lbud
    ContributorAuthor

    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

  2. jfirebaugh commented on Jan 7, 2015

    @jfirebaugh
    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.

  3. lbud commented on Jan 7, 2015

    @lbud
    ContributorAuthor

    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.

  4. lbud commented on Jan 8, 2015

    @lbud
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions