SINTEF-9012 / PruneCluster

Fast and realtime marker clustering for Leaflet
MIT License
552 stars 131 forks source link

Icon is reset on cluster marker when nothing has changed #172

Open ccjenkins14 opened 5 years ago

ccjenkins14 commented 5 years ago

I am able to encounter a case where cluster.hashCode !== data._leafletOldHashCode , causing the icon to be reset, however, there is no discernible difference between the cached clusters except for the hash code.

Lines 397 - 404 of LeafletAdapter.js

// Update the icon if the population of his content has changed or if we need to reset the icon
if (resetIcons || cluster.population != data._leafletOldPopulation ||
    cluster.hashCode !== data._leafletOldHashCode) {
    var boundsCopy = {};
    L.Util.extend(boundsCopy, cluster.bounds);
    (<any>oldMarker)._leafletClusterBounds = boundsCopy;
    oldMarker.setIcon(this.BuildLeafletClusterIcon(cluster));
}

I am using bower package version 2.1.0.