js-markerclusterer icon indicating copy to clipboard operation
js-markerclusterer copied to clipboard

Markers disappears when zooming out in GridAlgorithm

Open fjaderboll opened this issue 4 years ago • 0 comments

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

  1. Replicate-able in both Windows/Linux and Chrome/FireFox
  2. Version v1.0.16

Steps to reproduce

  1. Go to https://googlemaps.github.io/js-markerclusterer/public/algorithms/
  2. Zoom out until you see two continents
  3. 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();

fjaderboll avatar Dec 07 '21 10:12 fjaderboll