Fix for map cluster size icons not disappearing after zoom Normally zooming on a cluster icon far enough to show individual pins should also hide the cluster icon. Some time recently this stopped happening, which is disruptive because the cluster icon could hide pins underneath and make them unreachable, and confusing because it gave the impression there would be more pins if you keep zooming. It seems likely that some maps API update introduced a collision with the 'remove' method. Renaming the method was found to fix the bug. Repro: https://screencast.googleplex.com/cast/NjMyNzQ5NTc2NTc4NjYyNHwxNDRkMmMyYS0xYQ Fix: https://screencast.googleplex.com/cast/NTM3NzQ1MDc0NDc0MTg4OHwwNDcxY2NjYi04ZA Fixes: b/493541353 Change-Id: I52d852c7ab68230bbcfdd1d6efcfedaceafc544a Reviewed-on: https://gnocchi-internal-review.git.corp.google.com/c/third_party/@google/markerclusterer/+/297685 Reviewed-by: Hughes Hilton <hugheshilton@google.com>
diff --git a/src/markerclusterer.js b/src/markerclusterer.js index 466c41d..08236cc 100644 --- a/src/markerclusterer.js +++ b/src/markerclusterer.js
@@ -924,7 +924,7 @@ * Removes the cluster */ Cluster.prototype.remove = function() { - this.clusterIcon_.remove(); + this.clusterIcon_.removeClusterIcon(); this.markers_.length = 0; delete this.markers_; }; @@ -1148,7 +1148,9 @@ /** * Remove the icon from the map */ -ClusterIcon.prototype.remove = function() { +// b/493541353: rename 'remove' to 'removeClusterIcon' to dodge Google Maps' +// new OverlayView.remove API collision without breaking maps internals +ClusterIcon.prototype.removeClusterIcon = function() { this.setMap(null); };