Skip to content
This repository has been archived by the owner on Dec 9, 2021. It is now read-only.

fix: clustering map bounds #265

Merged
merged 1 commit into from
Oct 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions src/markerclusterer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down