@react-google-maps/marker-clusterer 2.10.1 → 2.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs.js CHANGED
@@ -2,6 +2,37 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ /******************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+ /* global Reflect, Promise */
20
+
21
+ var extendStatics = function(d, b) {
22
+ extendStatics = Object.setPrototypeOf ||
23
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
25
+ return extendStatics(d, b);
26
+ };
27
+
28
+ function __extends(d, b) {
29
+ if (typeof b !== "function" && b !== null)
30
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
31
+ extendStatics(d, b);
32
+ function __() { this.constructor = d; }
33
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
+ }
35
+
5
36
  var ClusterIcon = /** @class */ (function () {
6
37
  function ClusterIcon(cluster, styles) {
7
38
  cluster.getClusterer().extend(ClusterIcon, google.maps.OverlayView);
@@ -29,8 +60,6 @@ var ClusterIcon = /** @class */ (function () {
29
60
  this.cMouseDownInCluster = null;
30
61
  this.cDraggingMapByCluster = null;
31
62
  this.timeOut = null;
32
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
33
- // @ts-ignore
34
63
  this.setMap(cluster.getMap()); // Note: this causes onAdd to be called
35
64
  }
36
65
  ClusterIcon.prototype.onBoundsChanged = function () {
@@ -58,22 +87,23 @@ var ClusterIcon = /** @class */ (function () {
58
87
  // Zoom into the cluster.
59
88
  var maxZoom_1 = markerClusterer_1.getMaxZoom();
60
89
  var bounds_1 = this.cluster.getBounds();
61
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
62
- // @ts-ignore
63
- markerClusterer_1.getMap().fitBounds(bounds_1);
90
+ var map = markerClusterer_1.getMap();
91
+ if (map !== null && 'fitBounds' in map) {
92
+ map.fitBounds(bounds_1);
93
+ }
64
94
  // There is a fix for Issue 170 here:
65
95
  this.timeOut = window.setTimeout(function () {
66
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
67
- // @ts-ignore
68
- markerClusterer_1.getMap().fitBounds(bounds_1);
69
- // Don't zoom beyond the max zoom level
70
- if (maxZoom_1 !== null &&
71
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
72
- // @ts-ignore
73
- markerClusterer_1.getMap().getZoom() > maxZoom_1) {
74
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
75
- // @ts-ignore
76
- markerClusterer_1.getMap().setZoom(maxZoom_1 + 1);
96
+ var map = markerClusterer_1.getMap();
97
+ if (map !== null) {
98
+ if ('fitBounds' in map) {
99
+ map.fitBounds(bounds_1);
100
+ }
101
+ var zoom = map.getZoom() || 0;
102
+ // Don't zoom beyond the max zoom level
103
+ if (maxZoom_1 !== null &&
104
+ zoom > maxZoom_1) {
105
+ map.setZoom(maxZoom_1 + 1);
106
+ }
77
107
  }
78
108
  }, 100);
79
109
  }
@@ -103,23 +133,22 @@ var ClusterIcon = /** @class */ (function () {
103
133
  google.maps.event.trigger(this.cluster.getClusterer(), 'mouseout', this.cluster);
104
134
  };
105
135
  ClusterIcon.prototype.onAdd = function () {
136
+ var _a;
106
137
  this.div = document.createElement('div');
107
138
  this.div.className = this.className;
108
139
  if (this.visible) {
109
140
  this.show();
110
141
  }
111
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
112
- // @ts-ignore
113
- this.getPanes().overlayMouseTarget.appendChild(this.div);
114
- // Fix for Issue 157
115
- this.boundsChangedListener = google.maps.event.addListener(
116
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
117
- // @ts-ignore
118
- this.getMap(), 'bounds_changed', this.onBoundsChanged);
119
- this.div.addEventListener('mousedown', this.onMouseDown);
120
- this.div.addEventListener('click', this.onClick);
121
- this.div.addEventListener('mouseover', this.onMouseOver);
122
- this.div.addEventListener('mouseout', this.onMouseOut);
142
+ (_a = this.getPanes()) === null || _a === void 0 ? void 0 : _a.overlayMouseTarget.appendChild(this.div);
143
+ var map = this.getMap();
144
+ if (map !== null) {
145
+ // Fix for Issue 157
146
+ this.boundsChangedListener = google.maps.event.addListener(map, 'bounds_changed', this.onBoundsChanged);
147
+ this.div.addEventListener('mousedown', this.onMouseDown);
148
+ this.div.addEventListener('click', this.onClick);
149
+ this.div.addEventListener('mouseover', this.onMouseOver);
150
+ this.div.addEventListener('mouseout', this.onMouseOut);
151
+ }
123
152
  };
124
153
  ClusterIcon.prototype.onRemove = function () {
125
154
  if (this.div && this.div.parentNode) {
@@ -141,9 +170,9 @@ var ClusterIcon = /** @class */ (function () {
141
170
  };
142
171
  ClusterIcon.prototype.draw = function () {
143
172
  if (this.visible && this.div !== null && this.center) {
144
- var _a = this.getPosFromLatLng(this.center), x = _a.x, y = _a.y;
145
- this.div.style.top = "".concat(y, "px");
146
- this.div.style.left = "".concat(x, "px");
173
+ var pos = this.getPosFromLatLng(this.center);
174
+ this.div.style.top = pos !== null ? "".concat(pos.y, "px") : '0';
175
+ this.div.style.left = pos !== null ? "".concat(pos.x, "px") : '0';
147
176
  }
148
177
  };
149
178
  ClusterIcon.prototype.hide = function () {
@@ -171,8 +200,8 @@ var ClusterIcon = /** @class */ (function () {
171
200
  }
172
201
  this.div.style.cursor = 'pointer';
173
202
  this.div.style.position = 'absolute';
174
- this.div.style.top = "".concat(pos.y, "px");
175
- this.div.style.left = "".concat(pos.x, "px");
203
+ this.div.style.top = pos !== null ? "".concat(pos.y, "px") : '0';
204
+ this.div.style.left = pos !== null ? "".concat(pos.x, "px") : '0';
176
205
  this.div.style.width = "".concat(this.width, "px");
177
206
  this.div.style.height = "".concat(this.height, "px");
178
207
  var img = document.createElement('img');
@@ -229,10 +258,11 @@ var ClusterIcon = /** @class */ (function () {
229
258
  this.center = center;
230
259
  };
231
260
  ClusterIcon.prototype.getPosFromLatLng = function (latlng) {
232
- // @ts-ignore
233
261
  var pos = this.getProjection().fromLatLngToDivPixel(latlng);
234
- pos.x -= this.anchorIcon[1];
235
- pos.y -= this.anchorIcon[0];
262
+ if (pos !== null) {
263
+ pos.x -= this.anchorIcon[1];
264
+ pos.y -= this.anchorIcon[0];
265
+ }
236
266
  return pos;
237
267
  };
238
268
  return ClusterIcon;
@@ -241,8 +271,6 @@ var ClusterIcon = /** @class */ (function () {
241
271
  var Cluster = /** @class */ (function () {
242
272
  function Cluster(markerClusterer) {
243
273
  this.markerClusterer = markerClusterer;
244
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
245
- // @ts-ignore
246
274
  this.map = this.markerClusterer.getMap();
247
275
  this.gridSize = this.markerClusterer.getGridSize();
248
276
  this.minClusterSize = this.markerClusterer.getMinimumClusterSize();
@@ -279,8 +307,6 @@ var Cluster = /** @class */ (function () {
279
307
  return bounds;
280
308
  };
281
309
  Cluster.prototype.remove = function () {
282
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
283
- // @ts-ignore
284
310
  this.clusterIcon.setMap(null);
285
311
  this.markers = [];
286
312
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -288,6 +314,7 @@ var Cluster = /** @class */ (function () {
288
314
  delete this.markers;
289
315
  };
290
316
  Cluster.prototype.addMarker = function (marker) {
317
+ var _a;
291
318
  if (this.isMarkerAlreadyAdded(marker)) {
292
319
  return false;
293
320
  }
@@ -312,7 +339,7 @@ var Cluster = /** @class */ (function () {
312
339
  this.markers.push(marker);
313
340
  var mCount = this.markers.length;
314
341
  var maxZoom = this.markerClusterer.getMaxZoom();
315
- var zoom = this.map.getZoom();
342
+ var zoom = (_a = this.map) === null || _a === void 0 ? void 0 : _a.getZoom();
316
343
  if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {
317
344
  // Zoomed in past max zoom, so show the marker.
318
345
  if (marker.getMap() !== this.map) {
@@ -349,9 +376,10 @@ var Cluster = /** @class */ (function () {
349
376
  this.bounds = this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center, this.center));
350
377
  };
351
378
  Cluster.prototype.updateIcon = function () {
379
+ var _a;
352
380
  var mCount = this.markers.length;
353
381
  var maxZoom = this.markerClusterer.getMaxZoom();
354
- var zoom = this.map.getZoom();
382
+ var zoom = (_a = this.map) === null || _a === void 0 ? void 0 : _a.getZoom();
355
383
  if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {
356
384
  this.clusterIcon.hide();
357
385
  return;
@@ -381,7 +409,6 @@ var Cluster = /** @class */ (function () {
381
409
  return Cluster;
382
410
  }());
383
411
 
384
- /* global google */
385
412
  /**
386
413
  * Supports up to 9007199254740991 (Number.MAX_SAFE_INTEGER) markers
387
414
  * which is not a problem as max array length is 4294967296 (2**32)
@@ -402,91 +429,84 @@ var IMAGE_PATH = 'https://developers.google.com/maps/documentation/javascript/ex
402
429
  var IMAGE_EXTENSION = 'png';
403
430
  var IMAGE_SIZES = [53, 56, 66, 78, 90];
404
431
  var CLUSTERER_CLASS = 'cluster';
405
- var Clusterer = /** @class */ (function () {
432
+ var Clusterer = /** @class */ (function (_super) {
433
+ __extends(Clusterer, _super);
406
434
  function Clusterer(map, optMarkers, optOptions) {
407
435
  if (optMarkers === void 0) { optMarkers = []; }
408
436
  if (optOptions === void 0) { optOptions = {}; }
409
- this.extend(Clusterer, google.maps.OverlayView);
410
- this.markers = [];
411
- this.clusters = [];
412
- this.listeners = [];
413
- this.activeMap = null;
414
- this.ready = false;
415
- this.gridSize = optOptions.gridSize || 60;
416
- this.minClusterSize = optOptions.minimumClusterSize || 2;
417
- this.maxZoom = optOptions.maxZoom || null;
418
- this.styles = optOptions.styles || [];
419
- this.title = optOptions.title || '';
420
- this.zoomOnClick = true;
437
+ var _this = _super.call(this) || this;
438
+ _this.extend(Clusterer, google.maps.OverlayView);
439
+ _this.markers = [];
440
+ _this.clusters = [];
441
+ _this.listeners = [];
442
+ _this.activeMap = null;
443
+ _this.ready = false;
444
+ _this.gridSize = optOptions.gridSize || 60;
445
+ _this.minClusterSize = optOptions.minimumClusterSize || 2;
446
+ _this.maxZoom = optOptions.maxZoom || null;
447
+ _this.styles = optOptions.styles || [];
448
+ _this.title = optOptions.title || '';
449
+ _this.zoomOnClick = true;
421
450
  if (optOptions.zoomOnClick !== undefined) {
422
- this.zoomOnClick = optOptions.zoomOnClick;
451
+ _this.zoomOnClick = optOptions.zoomOnClick;
423
452
  }
424
- this.averageCenter = false;
453
+ _this.averageCenter = false;
425
454
  if (optOptions.averageCenter !== undefined) {
426
- this.averageCenter = optOptions.averageCenter;
455
+ _this.averageCenter = optOptions.averageCenter;
427
456
  }
428
- this.ignoreHidden = false;
457
+ _this.ignoreHidden = false;
429
458
  if (optOptions.ignoreHidden !== undefined) {
430
- this.ignoreHidden = optOptions.ignoreHidden;
459
+ _this.ignoreHidden = optOptions.ignoreHidden;
431
460
  }
432
- this.enableRetinaIcons = false;
461
+ _this.enableRetinaIcons = false;
433
462
  if (optOptions.enableRetinaIcons !== undefined) {
434
- this.enableRetinaIcons = optOptions.enableRetinaIcons;
435
- }
436
- this.imagePath = optOptions.imagePath || IMAGE_PATH;
437
- this.imageExtension = optOptions.imageExtension || IMAGE_EXTENSION;
438
- this.imageSizes = optOptions.imageSizes || IMAGE_SIZES;
439
- this.calculator = optOptions.calculator || CALCULATOR;
440
- this.batchSize = optOptions.batchSize || BATCH_SIZE;
441
- this.batchSizeIE = optOptions.batchSizeIE || BATCH_SIZE_IE;
442
- this.clusterClass = optOptions.clusterClass || CLUSTERER_CLASS;
463
+ _this.enableRetinaIcons = optOptions.enableRetinaIcons;
464
+ }
465
+ _this.imagePath = optOptions.imagePath || IMAGE_PATH;
466
+ _this.imageExtension = optOptions.imageExtension || IMAGE_EXTENSION;
467
+ _this.imageSizes = optOptions.imageSizes || IMAGE_SIZES;
468
+ _this.calculator = optOptions.calculator || CALCULATOR;
469
+ _this.batchSize = optOptions.batchSize || BATCH_SIZE;
470
+ _this.batchSizeIE = optOptions.batchSizeIE || BATCH_SIZE_IE;
471
+ _this.clusterClass = optOptions.clusterClass || CLUSTERER_CLASS;
443
472
  if (navigator.userAgent.toLowerCase().indexOf('msie') !== -1) {
444
473
  // Try to avoid IE timeout when processing a huge number of markers:
445
- this.batchSize = this.batchSizeIE;
474
+ _this.batchSize = _this.batchSizeIE;
446
475
  }
447
- this.timerRefStatic = null;
448
- this.setupStyles();
449
- this.addMarkers(optMarkers, true);
450
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
451
- // @ts-ignore
452
- this.setMap(map); // Note: this causes onAdd to be called
476
+ _this.timerRefStatic = null;
477
+ _this.setupStyles();
478
+ _this.addMarkers(optMarkers, true);
479
+ _this.setMap(map); // Note: this causes onAdd to be called
480
+ return _this;
453
481
  }
482
+ Clusterer.prototype.onZoomChanged = function () {
483
+ var _a, _b;
484
+ this.resetViewport(false);
485
+ // Workaround for this Google bug: when map is at level 0 and "-" of
486
+ // zoom slider is clicked, a "zoom_changed" event is fired even though
487
+ // the map doesn't zoom out any further. In this situation, no "idle"
488
+ // event is triggered so the cluster markers that have been removed
489
+ // do not get redrawn. Same goes for a zoom in at maxZoom.
490
+ if (((_a = this.getMap()) === null || _a === void 0 ? void 0 : _a.getZoom()) === (this.get('minZoom') || 0) ||
491
+ ((_b = this.getMap()) === null || _b === void 0 ? void 0 : _b.getZoom()) === this.get('maxZoom')) {
492
+ google.maps.event.trigger(this, 'idle');
493
+ }
494
+ };
495
+ Clusterer.prototype.onIdle = function () {
496
+ this.redraw();
497
+ };
454
498
  Clusterer.prototype.onAdd = function () {
455
- var _this = this;
456
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
457
- // @ts-ignore
458
- this.activeMap = this.getMap();
499
+ var map = this.getMap();
500
+ this.activeMap = map;
459
501
  this.ready = true;
460
502
  this.repaint();
461
- // Add the map event listeners
462
- this.listeners = [
463
- google.maps.event.addListener(
464
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
465
- // @ts-ignore
466
- this.getMap(), 'zoom_changed', function () {
467
- _this.resetViewport(false);
468
- // Workaround for this Google bug: when map is at level 0 and "-" of
469
- // zoom slider is clicked, a "zoom_changed" event is fired even though
470
- // the map doesn't zoom out any further. In this situation, no "idle"
471
- // event is triggered so the cluster markers that have been removed
472
- // do not get redrawn. Same goes for a zoom in at maxZoom.
473
- if (
474
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
475
- // @ts-ignore
476
- _this.getMap().getZoom() === (_this.get('minZoom') || 0) ||
477
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
478
- // @ts-ignore
479
- _this.getMap().getZoom() === _this.get('maxZoom')) {
480
- google.maps.event.trigger(_this, 'idle');
481
- }
482
- }),
483
- google.maps.event.addListener(
484
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
485
- // @ts-ignore
486
- this.getMap(), 'idle', function () {
487
- _this.redraw();
488
- }),
489
- ];
503
+ if (map !== null) {
504
+ // Add the map event listeners
505
+ this.listeners = [
506
+ google.maps.event.addListener(map, 'zoom_changed', this.onZoomChanged),
507
+ google.maps.event.addListener(map, 'idle', this.onIdle),
508
+ ];
509
+ }
490
510
  };
491
511
  Clusterer.prototype.onRemove = function () {
492
512
  // Put all the managed markers back on the map:
@@ -531,9 +551,10 @@ var Clusterer = /** @class */ (function () {
531
551
  bounds.extend(position);
532
552
  }
533
553
  }
534
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
535
- // @ts-ignore
536
- this.getMap().fitBounds(bounds);
554
+ var map = this.getMap();
555
+ if (map !== null && 'fitBounds' in map) {
556
+ map.fitBounds(bounds);
557
+ }
537
558
  };
538
559
  Clusterer.prototype.getGridSize = function () {
539
560
  return this.gridSize;
@@ -723,27 +744,37 @@ var Clusterer = /** @class */ (function () {
723
744
  }, 0);
724
745
  };
725
746
  Clusterer.prototype.getExtendedBounds = function (bounds) {
726
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
727
- // @ts-ignore
728
747
  var projection = this.getProjection();
729
748
  // Convert the points to pixels and the extend out by the grid size.
730
749
  var trPix = projection.fromLatLngToDivPixel(
731
750
  // Turn the bounds into latlng.
732
751
  new google.maps.LatLng(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()));
733
- trPix.x += this.gridSize;
734
- trPix.y -= this.gridSize;
752
+ if (trPix !== null) {
753
+ trPix.x += this.gridSize;
754
+ trPix.y -= this.gridSize;
755
+ }
735
756
  var blPix = projection.fromLatLngToDivPixel(
736
757
  // Turn the bounds into latlng.
737
758
  new google.maps.LatLng(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()));
738
- blPix.x -= this.gridSize;
739
- blPix.y += this.gridSize;
759
+ if (blPix !== null) {
760
+ blPix.x -= this.gridSize;
761
+ blPix.y += this.gridSize;
762
+ }
740
763
  // Extend the bounds to contain the new bounds.
741
- bounds.extend(
742
- // Convert the pixel points back to LatLng nw
743
- projection.fromDivPixelToLatLng(trPix));
744
- bounds.extend(
745
- // Convert the pixel points back to LatLng sw
746
- projection.fromDivPixelToLatLng(blPix));
764
+ if (trPix !== null) {
765
+ // Convert the pixel points back to LatLng nw
766
+ var point1 = projection.fromDivPixelToLatLng(trPix);
767
+ if (point1 !== null) {
768
+ bounds.extend(point1);
769
+ }
770
+ }
771
+ if (blPix !== null) {
772
+ // Convert the pixel points back to LatLng sw
773
+ var point2 = projection.fromDivPixelToLatLng(blPix);
774
+ if (point2 !== null) {
775
+ bounds.extend(point2);
776
+ }
777
+ }
747
778
  return bounds;
748
779
  };
749
780
  Clusterer.prototype.redraw = function () {
@@ -830,31 +861,21 @@ var Clusterer = /** @class */ (function () {
830
861
  delete this.timerRefStatic;
831
862
  }
832
863
  }
864
+ var map = this.getMap();
865
+ var bounds = map !== null && 'getBounds' in map ? map.getBounds() : null;
866
+ var zoom = (map === null || map === void 0 ? void 0 : map.getZoom()) || 0;
833
867
  // Get our current map view bounds.
834
868
  // Create a new bounds object so we don't affect the map.
835
869
  //
836
870
  // See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug:
837
- var mapBounds =
838
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
839
- // @ts-ignore
840
- this.getMap().getZoom() > 3
841
- ? new google.maps.LatLngBounds(
842
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
843
- // @ts-ignore
844
- this.getMap()
845
- .getBounds()
846
- .getSouthWest(),
847
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
848
- // @ts-ignore
849
- this.getMap()
850
- .getBounds()
851
- .getNorthEast())
871
+ var mapBounds = zoom > 3
872
+ ? new google.maps.LatLngBounds(bounds === null || bounds === void 0 ? void 0 : bounds.getSouthWest(), bounds === null || bounds === void 0 ? void 0 : bounds.getNorthEast())
852
873
  : new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472, -178.48388434375), new google.maps.LatLng(-85.08136444384544, 178.00048865625));
853
- var bounds = this.getExtendedBounds(mapBounds);
874
+ var extendedMapBounds = this.getExtendedBounds(mapBounds);
854
875
  var iLast = Math.min(iFirst + this.batchSize, this.markers.length);
855
876
  for (var i = iFirst; i < iLast; i++) {
856
877
  var marker = this.markers[i];
857
- if (!marker.isAdded && this.isMarkerInBounds(marker, bounds) && (!this.ignoreHidden || (this.ignoreHidden && marker.getVisible()))) {
878
+ if (!marker.isAdded && this.isMarkerInBounds(marker, extendedMapBounds) && (!this.ignoreHidden || (this.ignoreHidden && marker.getVisible()))) {
858
879
  this.addToClosestCluster(marker);
859
880
  }
860
881
  }
@@ -880,19 +901,14 @@ var Clusterer = /** @class */ (function () {
880
901
  };
881
902
  Clusterer.prototype.extend = function (obj1, obj2) {
882
903
  return function applyExtend(object) {
883
- // eslint-disable-next-line guard-for-in
884
904
  for (var property in object.prototype) {
885
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
886
- // @ts-ignore
887
- this.prototype[property] = object.prototype[property];
905
+ this.prototype.set(property, object.prototype.get(property));
888
906
  }
889
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
890
- // @ts-ignore
891
907
  return this;
892
908
  }.apply(obj1, [obj2]);
893
909
  };
894
910
  return Clusterer;
895
- }());
911
+ }(google.maps.OverlayView));
896
912
 
897
913
  exports.Cluster = Cluster;
898
914
  exports.ClusterIcon = ClusterIcon;