js-markerclusterer
js-markerclusterer copied to clipboard
Markers disappears when zooming out in GridAlgorithm
When zooming out around when you can see two continents, the markers disapperas for the three algorithms GridAlgorithm, KmeansAlgorithm and DBScanAlgorithm. This can easily be seen in the algorithm demo.
Environment details
- Replicate-able in both Windows/Linux and Chrome/FireFox
- Version v1.0.16
Steps to reproduce
- Go to https://googlemaps.github.io/js-markerclusterer/public/algorithms/
- Zoom out until you see two continents
- The markers/clusters disappear in 3 of 5 algorithms.
Code example
The problem seem to be in this function, when extending the bounds, new bounds gets wrong.
filterMarkersToPaddedViewport(map, mapCanvasProjection, markers, viewportPadding)
var extendedMapBounds = extendBoundsToPaddedViewport(map.getBounds(), mapCanvasProjection, viewportPadding);
A quick and dirty workaround is to just not extend the bounds:
var extendedMapBounds = map.getBounds();