Open thdoan opened 8 years ago
This also affects me. Add the following to line 229.
/**
* Implementaion of the interface method.
* @ignore
*/
MarkerClusterer.prototype.onRemove = function () {
this.setReady_(true);
};
On top of implementing the onRemove() as suggested junalmeida , you will also need to take care of
@jerrywang121 your solution works perfectly! Could you make it into a pull request?
My short solution to this problem was to first overwrite the onRemove() function before calling the constructor and nuking the clusters.
var mc =window.MarkerClusterer.prototype.onRemove = function(){
for ( var i = 0 ; i < this.clusters_.length; i++){
this.clusters_[i].remove()
}
}
And then instantiate the Markerclusterer
mc = new window.MarkerClusterer(map,filteredMarkers, options)
note that filteredMarkers are my google markers and and the options I pass into the constructor options is an imagePath and the maxzoom options. it doesn't effect the way the solution is implemented.
Then finally I call the setMap(null) method on the Markercluster object which fires the onRemove function:
mc.setMap(null)
Also not that I remove the google markers from the map (by calling the setMap(null) method on each marker) before calling the mc.SetMap(null) method.
I got the same error, Use markerCluster.clearMarkers(); works
@longcui genius!!!
I get this error when I try to disable the marker clusterer overlay:
Console output: