PaulLeCam / react-leaflet

React components for Leaflet maps
https://react-leaflet.js.org
Other
5.13k stars 884 forks source link

react-leaflet marker-cluster support #121

Closed GalitTugi closed 8 years ago

GalitTugi commented 8 years ago

hello, I'm using react-leaflet with MarkerCluster, using the example in the previous issues (https://github.com/PaulLeCam/react-leaflet/issues/42).

Everytime a cluster changes (opens up, for example), the click event is removed from the listeners. That means, the click event on the map I subscribed to, is no longer fired. Has anybody ran into that problem \ have a reasonable solution?

I'm using versions: leaflet: 0.7.7 react-leaflet: 0.9.0 leaflet.markercluster: 0.7

I figured out the source to the problem, it happens when the markerCluster component calls "removeLayer", which calls L.Path.onRemove. In this function it literally removes the click event listener (line 5052 in leaflet-src.js).

Thanks.

camrongodbout commented 8 years ago

+1

PaulLeCam commented 8 years ago

Hi,

Seems your issue is with MarkerCluster, how is it related to this lib?