diff --git a/projects/ngx-openlayers/src/lib/sources/cluster.component.ts b/projects/ngx-openlayers/src/lib/sources/cluster.component.ts
index 120c0473..fb3d949d 100644
--- a/projects/ngx-openlayers/src/lib/sources/cluster.component.ts
+++ b/projects/ngx-openlayers/src/lib/sources/cluster.component.ts
@@ -1,4 +1,13 @@
-import { Component, Host, Input, forwardRef, ContentChild, AfterContentInit } from '@angular/core';
+import {
+ Component,
+ Host,
+ Input,
+ forwardRef,
+ ContentChild,
+ AfterContentInit,
+ SimpleChanges,
+ OnChanges,
+} from '@angular/core';
import { Feature } from 'ol';
import { LayerVectorComponent } from '../layers/layervector.component';
import { SourceComponent } from './source.component';
@@ -13,7 +22,7 @@ import { Point } from 'ol/geom';
`,
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceClusterComponent) }],
})
-export class SourceClusterComponent extends SourceComponent implements AfterContentInit {
+export class SourceClusterComponent extends SourceComponent implements AfterContentInit, OnChanges {
instance: Cluster;
@Input()
@@ -37,4 +46,10 @@ export class SourceClusterComponent extends SourceComponent implements AfterCont
this.instance = new Cluster(this);
this.host.instance.setSource(this.instance);
}
+
+ ngOnChanges(changes: SimpleChanges) {
+ if (this.instance && changes.hasOwnProperty('distance')) {
+ this.instance.setDistance(this.distance);
+ }
+ }
}
diff --git a/src/app/cluster/cluster.component.ts b/src/app/cluster/cluster.component.ts
index 6f318902..f77fa91d 100644
--- a/src/app/cluster/cluster.component.ts
+++ b/src/app/cluster/cluster.component.ts
@@ -29,7 +29,6 @@ import { Component, OnInit } from '@angular/core';