From 8ab5b83cc977c9bdd6f3559a728bcde3b12fd828 Mon Sep 17 00:00:00 2001 From: Kevin OH Date: Tue, 12 Oct 2021 07:02:30 +1300 Subject: [PATCH] fix: clustering map bounds --- src/markerclusterer.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/markerclusterer.ts b/src/markerclusterer.ts index 98ca57df..40c433a0 100644 --- a/src/markerclusterer.ts +++ b/src/markerclusterer.ts @@ -1096,19 +1096,10 @@ export class MarkerClusterer extends OverlayViewSafe { // Create a new bounds object so we don't affect the map. // // See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug: - let mapBounds: google.maps.LatLngBounds; - - if (this.getMap().getZoom() > 3) { - mapBounds = new google.maps.LatLngBounds( - (this.getMap() as google.maps.Map).getBounds().getSouthWest(), - (this.getMap() as google.maps.Map).getBounds().getNorthEast() - ); - } else { - mapBounds = new google.maps.LatLngBounds( - new google.maps.LatLng(85.02070771743472, -178.48388434375), - new google.maps.LatLng(-85.08136444384544, 178.00048865625) - ); - } + const mapBounds: google.maps.LatLngBounds = new google.maps.LatLngBounds( + (this.getMap() as google.maps.Map).getBounds().getSouthWest(), + (this.getMap() as google.maps.Map).getBounds().getNorthEast() + ); const bounds = this.getExtendedBounds(mapBounds); const iLast = Math.min(iFirst + this.batchSize_, this.markers_.length);