@@ -32,6 +32,9 @@ import {GoogleMap} from '../google-map/google-map';
32
32
import { MapEventManager } from '../map-event-manager' ;
33
33
import { MapMarker } from '../map-marker/map-marker' ;
34
34
35
+ /** Default options for a clusterer. */
36
+ const DEFAULT_CLUSTERER_OPTIONS : MarkerClustererOptions = { } ;
37
+
35
38
/**
36
39
* Angular component for implementing a Google Maps Marker Clusterer.
37
40
*
@@ -153,6 +156,12 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges,
153
156
}
154
157
private _zoomOnClick : boolean ;
155
158
159
+ @Input ( )
160
+ set options ( options : MarkerClustererOptions ) {
161
+ this . _options = options ;
162
+ }
163
+ private _options : MarkerClustererOptions ;
164
+
156
165
/**
157
166
* See
158
167
* googlemaps.github.io/v3-utility-library/modules/
@@ -212,6 +221,9 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges,
212
221
} = this ;
213
222
214
223
if ( clusterer ) {
224
+ if ( changes [ 'options' ] ) {
225
+ clusterer . setOptions ( this . _combineOptions ( ) ) ;
226
+ }
215
227
if ( changes [ 'ariaLabelFn' ] ) {
216
228
clusterer . ariaLabelFn = ariaLabelFn ;
217
229
}
@@ -376,25 +388,27 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges,
376
388
}
377
389
378
390
private _combineOptions ( ) : MarkerClustererOptions {
391
+ const options = this . _options || DEFAULT_CLUSTERER_OPTIONS ;
379
392
return {
380
- ariaLabelFn : this . ariaLabelFn ,
381
- averageCenter : this . _averageCenter ,
382
- batchSize : this . batchSize ,
383
- batchSizeIE : this . _batchSizeIE ,
384
- calculator : this . _calculator ,
385
- clusterClass : this . _clusterClass ,
386
- enableRetinaIcons : this . _enableRetinaIcons ,
387
- gridSize : this . _gridSize ,
388
- ignoreHidden : this . _ignoreHidden ,
389
- imageExtension : this . _imageExtension ,
390
- imagePath : this . _imagePath ,
391
- imageSizes : this . _imageSizes ,
392
- maxZoom : this . _maxZoom ,
393
- minimumClusterSize : this . _minimumClusterSize ,
394
- styles : this . _styles ,
395
- title : this . _title ,
396
- zIndex : this . _zIndex ,
397
- zoomOnClick : this . _zoomOnClick ,
393
+ ...options ,
394
+ ariaLabelFn : this . ariaLabelFn ?? options . ariaLabelFn ,
395
+ averageCenter : this . _averageCenter ?? options . averageCenter ,
396
+ batchSize : this . batchSize ?? options . batchSize ,
397
+ batchSizeIE : this . _batchSizeIE ?? options . batchSizeIE ,
398
+ calculator : this . _calculator ?? options . calculator ,
399
+ clusterClass : this . _clusterClass ?? options . clusterClass ,
400
+ enableRetinaIcons : this . _enableRetinaIcons ?? options . enableRetinaIcons ,
401
+ gridSize : this . _gridSize ?? options . gridSize ,
402
+ ignoreHidden : this . _ignoreHidden ?? options . ignoreHidden ,
403
+ imageExtension : this . _imageExtension ?? options . imageExtension ,
404
+ imagePath : this . _imagePath ?? options . imagePath ,
405
+ imageSizes : this . _imageSizes ?? options . imageSizes ,
406
+ maxZoom : this . _maxZoom ?? options . maxZoom ,
407
+ minimumClusterSize : this . _minimumClusterSize ?? options . minimumClusterSize ,
408
+ styles : this . _styles ?? options . styles ,
409
+ title : this . _title ?? options . title ,
410
+ zIndex : this . _zIndex ?? options . zIndex ,
411
+ zoomOnClick : this . _zoomOnClick ?? options . zoomOnClick ,
398
412
} ;
399
413
}
400
414
0 commit comments