diff --git a/react-for-template/src/TemplateMapViewController.ts b/react-for-template/src/TemplateMapViewController.ts index 6009e9d..fcbce32 100644 --- a/react-for-template/src/TemplateMapViewController.ts +++ b/react-for-template/src/TemplateMapViewController.ts @@ -193,12 +193,14 @@ export class TemplateMapViewController extends BaseMapViewController implements } async clearOverlays(): Promise { - await this.markerController.clear(); - await this.circleController.clear(); - await this.polylineController.clear(); - await this.polygonController.clear(); - await this.groundImageController.clear(); - await this.rasterLayerController.clear(); + await this.clearOverlayControllers([ + this.markerController, + this.circleController, + this.polylineController, + this.polygonController, + this.groundImageController, + this.rasterLayerController, + ]); } /** 地図の破棄。登録済みコントローラの後始末はコアがやる。 */ diff --git a/react-for-template/test/TemplateDriverConformance.test.mjs b/react-for-template/test/TemplateDriverConformance.test.mjs index 7aa7abe..a17105f 100644 --- a/react-for-template/test/TemplateDriverConformance.test.mjs +++ b/react-for-template/test/TemplateDriverConformance.test.mjs @@ -33,6 +33,16 @@ test('every overlay kind is reachable from the Capable facade and the cascade', MapDriverConformance.checkOverlaySlots(controller.overlayControllers); }); +/** + * `clearOverlays()` は自分の 6 つだけでなく、拡張が登録したマーカーのコントローラ + * (クラスタリングの `StrategyMarkerController` など)も clear すること。 + * `clearOverlayControllers()` を通さないと、ここで落ちる。 + */ +test('clearOverlays() reaches the marker controllers extensions register', async () => { + const controller = new TemplateMapViewController(new TemplateMap()); + await MapDriverConformance.checkClearOverlaysReachesExtensions(controller); +}); + test('zoom converter round-trips, is monotonic and clamps', () => { const controller = new TemplateMapViewController(new TemplateMap()); MapDriverConformance.checkZoomConverter(controller.zoomConverter);