Leaflet / Leaflet.VectorGrid

Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet 1.0.0
598 stars 194 forks source link

Detection of features at pointer position in Firefox vs. Chrome #90

Closed MrSnyder closed 7 years ago

MrSnyder commented 7 years ago

Thank you for this great project, it's working very well for me.

I am experiencing one issue, though. When clicking (or mouse-overing) on an interactive vector tile layer, the detection of features at the pointer position works perfect in Firefox. However, in Chrome (and Edge / IE 11 with fetch-polyfill) often neighbouring features are detected instead of the one that should actually be at the mouse position.

Is this a known problem?

Setup:

Tested browsers:

P.S.: I briefly tried with Leaflet.VectorGrid master as well, but the click event doesn't seem to work currently...

perliedman commented 7 years ago

I think what you're seeing might be a problem with Leaflet's _clickTolerance: when touch support is enabled, which it always is in recent versions of Chrome, it will use a large tolerance, to make it easier to hit things. This has the unfortunate side effect that you sometimes hit the wrong feature, since they aren't prioritized.

So, assuming this is the problem you're seeing, this is actually a Leaflet issue when using the canvas renderer, and not specific to Leaflet.VectorGrid.

MrSnyder commented 7 years ago

Yep, you're right

Thank you for pointing this out.