Leaflet / Leaflet.markercluster

Marker Clustering plugin for Leaflet
MIT License
3.96k stars 997 forks source link

Cluster marker does not go away when pinch-zooming #790

Open leinonen opened 7 years ago

leinonen commented 7 years ago

How to reproduce

What behaviour I'm expecting and which behaviour I'm seeing

Expecting the marker to go away, or markers to be clustered, not both

This could be related to the maxBounds used (but that is our use case, see fiddle)

Minimal example reproducing the issue

danzel commented 7 years ago

I don't see how to reproduce it on your example. There are two markers that aren't clustered, and you can't zoom out anyway?

danzel commented 7 years ago

hahaha ok I think I figured it out. Continuously try and pinch zoom out (which the map will automatically undo/cancel), and eventually you end up with a cluster and the markers on the map?

leinonen commented 7 years ago

Yes exactly :)

leinonen commented 7 years ago

It's a corner case, but apparently some users experience this behaviour.

QimatLuo commented 7 years ago

I got this issue also. But it's not a corner case for me. Because I have a lot of pins on map, so it's very easy to see this bug when pinch zoom out. Hope it can be fix at the future.

Smiche commented 7 years ago

Having the same issue only on mobile(iOS and Android). Will try to find a fix for it.

wuxiashuangji commented 7 years ago

I got this issue also.

saadsaifse commented 5 years ago

Same issue here as well. Any fix yet?

peter1599 commented 1 year ago

Anything on this?

Its a really annoying bug especially when you have lot of markers. I get a cluster which says it has 900+ markers inside and it doesnt go away.

peter1599 commented 1 year ago

Okay so if anyone finds this I have a workaround:

Make an array at the top of your code like:

let clusterholder1: L.MarkerClusterGroup[] = [];

Then later after your cluster init push the whole cluster in the array.

clusterholder1.push(mycluster1);

Then attach a zoomend event on the map like this:

myMapVar.on('zoomend', () => {

myMapVar.removeLayer(clusterholder1.at(0)); //Make sure we dont duplicate cluster if(myMapVar.hasLayer(clusterholder1.at(0) === false) { myMapVar.addLayer(clusterholder1.at(0)); }

});

This comes with 1 cost:

You loose the beautiful animation for makers going in&out from the cluster.

But for me ... honestly its not a problem cause at least the 'ghost clusters' are gone.