Leaflet / Leaflet.VectorGrid

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

Fix mouse events on overzoomed canvas tiles #252

Open zmbc opened 3 years ago

zmbc commented 3 years ago

When using maxZoom and maxNativeZoom to "overzoom" tiles to higher zoom levels, the existing Canvas.Tile logic incorrectly calculates where the mouse is within the tile, because it does not scale the real pixels to the canvas' pixels, which are now 2, 4, 8, etc times larger. This means that features cannot be hovered or clicked on.

This commit adds logic to scale offsets and mouse locations according to the overzoom factor, which restores the behavior of non-overzoomed tiles.