Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit fb402f3

Browse files
committed
fix(SebmGoogleMapCircle): removing circles
Fixes #650 Closes #657
1 parent 1bc2ed8 commit fb402f3

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/core/directives/google-map-circle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ export class SebmGoogleMapCircle implements OnInit, OnChanges, OnDestroy {
247247
ngOnDestroy() {
248248
this._eventSubscriptions.forEach(function(s: Subscription) { s.unsubscribe(); });
249249
this._eventSubscriptions = null;
250+
this._manager.removeCircle(this);
250251
}
251252

252253
/**

src/core/services/managers/circle-manager.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ export class CircleManager {
3232
}));
3333
};
3434

35+
/**
36+
* Removes the given circle from the map.
37+
*/
38+
removeCircle(circle: SebmGoogleMapCircle): Promise<void> {
39+
return this._circles.get(circle).then((c) => {
40+
c.setMap(null);
41+
this._circles.delete(circle);
42+
});
43+
}
44+
3545
setOptions(circle: SebmGoogleMapCircle, options: mapTypes.CircleOptions): Promise<void> {
3646
return this._circles.get(circle).then((c) => c.setOptions(options));
3747
};

0 commit comments

Comments
 (0)