PruneCluster
PruneCluster copied to clipboard
sometime after move markers some clusters dont work - havent markers
Hello,
great plugin, I try use it, but sometimes clusters dont work. I hope that I simulated it. In this sample after markers move, top-right cluster dont have markers. When I clicking on it nothing happens. When I zoom out/in or move markers outside screen (probably after some recomputing) it works fine.
var map = L.map("map", {
attributionControl: false,
zoomControl: false
}).setView(new L.LatLng(59.911111, 10.752778), 18);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
detectRetina: true,
maxNativeZoom: 17
}).addTo(map);
var leafletView = new PruneClusterForLeaflet(70);
var size = 15;
var markers = [];
for (var i = 0; i < size; ++i) {
var marker = new PruneCluster.Marker(59.91111 + i * 0.00005, 10.752778 + i * 0.00005);
markers.push(marker);
leafletView.RegisterMarker(marker);
}
window.setTimeout(function () {
for (i = 0; i < size ; ++i) {
var ll = markers[i].position;
ll.lng += 0.0001;
}
leafletView.ProcessView();
}, 1000);
map.addLayer(leafletView);
thanks for help, I really like this plugin
Thank you for this bug report. I will look into it as soon as I have time
I made simpler sample only with 2 markers http://jsfiddle.net/knvnp9og/7/
Thank you for this new jsfiddle, it really helped. I think I saw this bug in my applications few times but I never took enough time to reproduce it.
About the bug itself, a cluster marker could be recycled after an update if it contains the same data and it hasn't moved a lot. But the position wasn't updated in the "click" event listener.
I tested a quick fix on the bugfix-87 branch. Can you get the compiled version and test it?
it is much better but sometime is still some problem. number in cluster is different than number of markers in spider
Ok, it's probably still the same problem. I will try to fix it this weekend.
it is only few times, it take long time to find this cluster, I try make simple sample but it is hard now ;)
http://jsfiddle.net/knvnp9og/8/ there are 2 clusters(number 3 and number 6) with 9 markers with old version cluster 3 has 0 markers and cluster 6 has 9 markers with new version cluster 3 has 3 markers and cluster 6 has 9 markers
Hi. Thank you again for the nice jsfiddles.
I implemented few fixes and I hope that resolves the problem. You can try the updated version.
after few tests it looks good
after more tests it is almost OK but there is still little problem. When some clusters are near, number of markers in spider is bigger than number in cluster. one marker is in both spiders. But I think it is acceptable for now.
I implemented an algorithm to prevent that but I may have forgot one or two situations. I will try to fix that before merging the fix to the master branch.
OK, maybe I'll make some sample but time is what I need ;)
I made sample but I think it is something else. http://jsfiddle.net/knvnp9og/9/ I don't know if is correct: var leafletView = new PruneClusterForLeaflet(20); leafletView.clusterMargin = 20;