diff --git a/package-lock.json b/package-lock.json index 231f8aa0a79ff99ce0dc9a13449b0dc8f6d294f1..76cfed61c5dad80deea4608d5fdf52e9988d29f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2645,28 +2645,6 @@ } } }, - "@runette/ngx-leaflet-locate": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@runette/ngx-leaflet-locate/-/ngx-leaflet-locate-1.0.3.tgz", - "integrity": "sha512-U792/VO5PvQKok7H4CHJ+u3L7Vy3Pca3Iki32CXVqloVzUOO0VcNMcF07NoLcXkUHEXX7hJ5I7OGivTyMFcYpQ==", - "requires": { - "@types/leaflet.locatecontrol": "^0.60.7", - "leaflet.locatecontrol": "^0.68.0", - "tslib": "^1.9.0" - }, - "dependencies": { - "leaflet.locatecontrol": { - "version": "0.68.0", - "resolved": "https://registry.npmjs.org/leaflet.locatecontrol/-/leaflet.locatecontrol-0.68.0.tgz", - "integrity": "sha512-jXJCpBvkyH6shjPEOK/DWu/tKX/WdkNeO96jyPrnGelYp9u6wSDj4V1V4aX9+CMTIrEyVB4/4XuU+T7VTRpb6w==" - }, - "tslib": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.0.tgz", - "integrity": "sha512-+Zw5lu0D9tvBMjGP8LpvMb0u2WW2QV3y+D8mO6J+cNzCYIN4sVy43Bf9vl92nqFahutN0I8zHa7cc4vihIshnw==" - } - } - }, "@schematics/angular": { "version": "10.1.3", "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-10.1.3.tgz", diff --git a/package.json b/package.json index a6dcfb3888825787628cffff2ef42ad34a57458d..5aeaf424d55fd987ebdd8585fdb2c41cff35f6be 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "@angular/router": "~10.1.3", "@asymmetrik/ngx-leaflet": "^8.1.0", "@ngx-translate/core": "^13.0.0", - "@runette/ngx-leaflet-locate": "^1.0.3", "json-server": "^0.16.2", "jwt-decode": "^3.1.2", "leaflet": "^1.7.1", @@ -47,6 +46,7 @@ "@types/jasminewd2": "~2.0.3", "@types/leaflet": "^1.5.17", "@types/node": "^12.12.67", + "@types/leaflet.locatecontrol": "^0.60.7", "codelyzer": "^6.0.0", "jasmine-core": "~3.6.0", "jasmine-spec-reporter": "~5.0.0", diff --git a/src/app/map/components/map.component.html b/src/app/map/components/map.component.html index 3503eec7065529255949474ce088d9ab6dbf0a3d..3af397dbb80481e93b5289f39a0bf16c72831435 100644 --- a/src/app/map/components/map.component.html +++ b/src/app/map/components/map.component.html @@ -1,8 +1,3 @@ <div class="map-wrapper"> <div id="map" class="body-wrap" leaflet [leafletOptions]="mapOptions" (leafletMapReady)="onMapReady($event)"></div> - <!-- <leaflet-locate-control - [map]="map" - [options]="locateOptions" - (location$)="sendLocationEvent($event)" - ></leaflet-locate-control> --> </div> diff --git a/src/app/map/components/map.component.ts b/src/app/map/components/map.component.ts index 0e10c60430f9b769c1be2121c5b89b0755ad109a..ad2bba78c884e987a36f93fc6d634f11d4fa0f0c 100644 --- a/src/app/map/components/map.component.ts +++ b/src/app/map/components/map.component.ts @@ -8,11 +8,10 @@ import { SimpleChanges, ViewChild, } from '@angular/core'; -import { latLng, MapOptions, geoJSON, tileLayer, Map, latLngBounds, layerGroup } from 'leaflet'; +import { latLng, MapOptions, geoJSON, tileLayer, Map, latLngBounds, layerGroup, Control } from 'leaflet'; import { Structure } from '../../models/structure.model'; import { GeojsonService } from '../../services/geojson.service'; import { MapService } from '../services/map.service'; -import { NgxLeafletLocateComponent } from '@runette/ngx-leaflet-locate'; import * as _ from 'lodash'; import { GeoJsonProperties } from '../models/geoJsonProperties.model'; import { MarkerType } from './markerType.enum'; @@ -20,6 +19,7 @@ import { typeStructureEnum } from '../../shared/enum/typeStructure.enum'; import metropole from '../../../assets/geojson/metropole.json'; import brignais from '../../../assets/geojson/brignais.json'; import L from 'leaflet'; +import 'leaflet.locatecontrol'; @Component({ selector: 'app-map', @@ -32,7 +32,6 @@ export class MapComponent implements OnChanges { @Input() public selectedMarkerId: string; @Input() public isMapPhone: boolean; @Input() public locate = false; - @ViewChild(NgxLeafletLocateComponent, { static: false }) locateComponent: NgxLeafletLocateComponent; @Output() selectedStructure: EventEmitter<Structure> = new EventEmitter<Structure>(); @Output() locatationTrigger: EventEmitter<boolean> = new EventEmitter<boolean>(); private lc; @@ -182,6 +181,7 @@ export class MapComponent implements OnChanges { this.map = map; // Handle location this.lc = L.control.locate(this.locateOptions).addTo(this.map); + // .locate(this.locateOptions).addTo(this.map); this.map.on('locationfound', () => { this.locatationTrigger.emit(true); }); diff --git a/src/app/map/map.module.ts b/src/app/map/map.module.ts index 521ecc6784cc5b12659516889e1526cf69bcb5df..fbb935ca5b3f27df1df0efded58dccc7d0380c1a 100644 --- a/src/app/map/map.module.ts +++ b/src/app/map/map.module.ts @@ -3,10 +3,9 @@ import { CommonModule, DatePipe } from '@angular/common'; import { SharedModule } from '../shared/shared.module'; import { MapComponents } from './components'; import { LeafletModule } from '@asymmetrik/ngx-leaflet'; -import { NgxLeafletLocateModule } from '@runette/ngx-leaflet-locate'; import { BrowserModule } from '@angular/platform-browser'; @NgModule({ - imports: [CommonModule, BrowserModule, SharedModule, NgxLeafletLocateModule, LeafletModule], + imports: [CommonModule, BrowserModule, SharedModule, LeafletModule], declarations: [MapComponents], providers: [DatePipe], exports: [MapComponents],