@@ -32,6 +32,9 @@ import {GoogleMap} from '../google-map/google-map';
3232import { MapEventManager } from '../map-event-manager' ;
3333import { MapMarker } from '../map-marker/map-marker' ;
3434
35+ /** Default options for a clusterer. */
36+ const DEFAULT_CLUSTERER_OPTIONS : MarkerClustererOptions = { } ;
37+
3538/**
3639 * Angular component for implementing a Google Maps Marker Clusterer.
3740 *
@@ -153,6 +156,12 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges,
153156 }
154157 private _zoomOnClick : boolean ;
155158
159+ @Input ( )
160+ set options ( options : MarkerClustererOptions ) {
161+ this . _options = options ;
162+ }
163+ private _options : MarkerClustererOptions ;
164+
156165 /**
157166 * See
158167 * googlemaps.github.io/v3-utility-library/modules/
@@ -212,6 +221,9 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges,
212221 } = this ;
213222
214223 if ( clusterer ) {
224+ if ( changes [ 'options' ] ) {
225+ clusterer . setOptions ( this . _combineOptions ( ) ) ;
226+ }
215227 if ( changes [ 'ariaLabelFn' ] ) {
216228 clusterer . ariaLabelFn = ariaLabelFn ;
217229 }
@@ -376,25 +388,27 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges,
376388 }
377389
378390 private _combineOptions ( ) : MarkerClustererOptions {
391+ const options = this . _options || DEFAULT_CLUSTERER_OPTIONS ;
379392 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 ,
398412 } ;
399413 }
400414
0 commit comments