jawj / OverlappingMarkerSpiderfier

Deals with overlapping markers in Google Maps JS API v3, Google Earth-style
http://blog.mackerron.com
836 stars 238 forks source link

JS Error when clicking in marker for showing an InfoWindow #141

Closed crismethods closed 6 years ago

crismethods commented 6 years ago

I am using both MarkererClusterPlus and OMS together, and in order to achieve a specific behaviour (explained below) when the cluster is clicked on I have to add to listeners, "_spiderclick" and "click".

The behaviour is that we have thousands of markers in the map, but not all of them are being clustered using MarkererClusterPlus, so we have a field in the marker indicating if it is clustered or not. When the user clicks on the cluster, then we zoom in and we trigger a "click" event in that cluster, which trigger the Spiderfier action but do not show any InfoWindow at that moment. When the items are been displayed as Spiderfied, then the user can click on one of the markers and we will display an InfoWindow. The case is that when the user clicks the marker we see the JS error attached on this Issue. We tried different things, for instance removing the "click" listener and only set the "_spiderclick" (which do not perform what we expect, as if we trigger the _spiderclick when the cluster is clicked, then the InfoWindow appears immediately and then open the Spiderfier, however the error is still there (not the time when we trigger the action calling "triggerEvent" but when we click manually with the mouse when it is showing the markers in an Spiderfier mode.

Any ideas about this?

We are adding the markers simultaneously to the MarkerClustererPlus (addMarkers with an array) and to OMS at the same time.

Thanks in advance!

Cheers

screen shot 2017-10-04 at 15 11 24

crismethods commented 6 years ago

Additional Information: we tried removing the InfoWindow opening when the marker is clicked, however the error still appears when you click on the icon, so it is not related with the IW itself, but with the click event when the marker is Spiderfied.

crismethods commented 6 years ago

SOLVED: the issue was that together with adding a marker to MarkerClusterer (using addMarkers(markers, true)) we were adding the marker to the OMS as: addMarker(marker, true), but it should be without a second argument.