Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildPruneCluster cluster/position sometimes gets another cluster or cluster is empty #179

Open
Valachio opened this issue Mar 19, 2019 · 0 comments

Comments

@Valachio
Copy link

Valachio commented Mar 19, 2019

So I've been noticing that pruneCluster.BuildLeafletCluster = function(cluster, position) {...} does not always return the correct cluster/position. When there are multiple clusters on the map, it sometimes return another cluster.

This happens sporadically. I'd say it happens 1 in 50 or 1 in 100? I tried tracking down the issue but the randomness of its occurrence makes it very difficult.

Can anyone provide some insights as to why this could be happening?

Sample code:

pruneCluster.BuildLeafletCluster = function(cluster, position) {
    let m = new L.Marker(position, {
        icon: pruneCluster.BuildLeafletClusterIcon(cluster)
    });
    m.on('click', function() {
        let markers = cluster.GetClusterMarkers();
    })
    return m;
}

EDIT: I managed to catch one instance of this, where the cluster is empty (even though there is 21 markers in this cluster). console.log shows that the cluster object has these weird properties:

Cluster {
    lastMarker: undefined,
    population: 0,
    _clusterMarkers: Array (0),
    hashCode: 1,
    totalWeight: 0,
    data: {
        _leafletOldPopulation: 16,
        _leafletOldHashCode: 101841549863470
    }
}

EDIT: I correct what I said earlier about it happening randomly. It does not happen randomly and happens to clusters in particular positions. Still trying to figure out the cause.

@Valachio Valachio changed the title GetClusterMarkers() accuracy BuildPruneCluster cluster/position sometimes gets another cluster Mar 19, 2019
@Valachio Valachio changed the title BuildPruneCluster cluster/position sometimes gets another cluster BuildPruneCluster cluster/position sometimes gets another cluster or cluster is empty Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant