diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d150e52..8aac2ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,5 +35,5 @@ jobs: with: artifacts: "dist/release.tgz" token: ${{ secrets.GITHUB_TOKEN }} - tag: "2.0.4" + tag: "2.0.5" diff --git a/package.json b/package.json index 2966d46..5075b44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@runette/ngx-leaflet-locate", - "version": "2.0.4", + "version": "2.0.5", "description": "Angular Wrapper for the Leaflet Location Control", "keywords": [ "angular", @@ -19,7 +19,7 @@ }, "dependencies": { "@types/leaflet.locatecontrol": "^0.74.0", - "leaflet.locatecontrol": "^0.76.1" + "leaflet.locatecontrol": "^0.78.0" }, "devDependencies": { "@angular/common": "^12.0.0", diff --git a/src/lib/ngx-leaflet-locate.component.ts b/src/lib/ngx-leaflet-locate.component.ts index e124643..5896ff9 100644 --- a/src/lib/ngx-leaflet-locate.component.ts +++ b/src/lib/ngx-leaflet-locate.component.ts @@ -3,6 +3,10 @@ import { Component, OnInit, OnDestroy, Input, Output, EventEmitter} from '@angul import {Map, control, Control, LocationEvent} from 'leaflet'; import '../../../../node_modules/leaflet.locatecontrol/dist/L.Control.Locate.min.js'; +interface customMap extends Map { + _unload: any; +} + @Component({ selector: 'leaflet-locate-control', template: '', @@ -20,7 +24,10 @@ export class NgxLeafletLocateComponent implements OnInit, OnDestroy { }; ngOnDestroy() { - if (this.control && this.map) this.control.stop() + if (this.control && this.map) { + this.control.stop(); + this._map?.off("unload", (this.map as customMap)?._unload, this.control); + } if (this._map && this.control) this._map.removeControl(this.control); this._map?.off('locationfound') };