OverlappingMarkerSpiderfier icon indicating copy to clipboard operation
OverlappingMarkerSpiderfier copied to clipboard

Programmatic click doesn't work with clusterer incorporated

Open btbowden opened this issue 5 years ago • 1 comments

I'm using the spidifier with the marker clusterer plugin and it works great, however there is one problem. I'm activating the marker click programmatically, which does fire the marker event, but doesn't open the info window or spidering as expected.

click event that gets fired: google.maps.event.trigger(localsLocation.Markers[index], 'spider_click');

event code: google.maps.event.addListener(marker, 'spider_click', function (e) { // 'spider_click', not plain 'click' marker.setZIndex(google.maps.Marker.MAX_ZINDEX); localsLocation.infoWindow.setContent("

" + data.Information + "
"); localsLocation.infoWindow.open(localsLocation.Map, marker); });

If I manually click the marker it works as expected though.

btbowden avatar Aug 26 '20 19:08 btbowden

I implemented a time delay on the clusterer constructor and it now works.

        setTimeout(function () {
            // Add a marker clusterer to manage the markers.
            const clusterOptions = {
                imagePath: "/Assets/Images/MarkerClusterer/",
                gridSize: 50,
                maxZoom: 15
            };
            localsLocation.MarkerCluster = new MarkerClusterer(localsLocation.Map, localsLocation.Markers, clusterOptions);
        }, timeout);

btbowden avatar Aug 28 '20 13:08 btbowden