diff --git a/web/angular/src/app/views/components/map/map.component.ts b/web/angular/src/app/views/components/map/map.component.ts index e4ff3ce..27ba834 100755 --- a/web/angular/src/app/views/components/map/map.component.ts +++ b/web/angular/src/app/views/components/map/map.component.ts @@ -28,6 +28,9 @@ export class MapComponent implements OnInit, OnDestroy { private defaultLocation: L.LatLng = new L.LatLng(51.4556, 7.0116); private defaultZoom = 13; + private currentLocation: L.LatLng; + private currentZoom: Number; + private zoomPanOptions: L.ZoomPanOptions = { animate: true, duration: 2, @@ -40,7 +43,9 @@ export class MapComponent implements OnInit, OnDestroy { private tileLayer: L.TileLayer; private defaultIcon = new L.Icon({ - iconUrl: require('leaflet/dist/images/marker-icon.png') + iconUrl: require('../../../../assets/img/marker_normal.png'), + iconSize: [50, 64], // size of the icon + iconAnchor: [25, 63], // point of the icon which will correspond to marker's location }); private marker: L.Marker; @@ -69,12 +74,18 @@ export class MapComponent implements OnInit, OnDestroy { maxZoom: 18 }).addTo(this.map); - L.easyButton('fa-globe', this.onSidebarToggle).addTo(this.map); + // L.easyButton('fa-globe', this.onSidebarToggle).addTo(this.map); // Initialize marker // this.marker.bindTooltip('Tooltip', {sticky: true}); this.setMapMarker(this.defaultLocation); + this.currentLocation = this.defaultLocation; + this.map.on('zoomend', () => { + this.consoleService.log('Zoom ended'); + this.setMapMarker(this.currentLocation); + }); + // If there is a given shareId in the URL, fetch the location from the API and // start to update every x seconds if (this.currentShare) { @@ -86,7 +97,8 @@ export class MapComponent implements OnInit, OnDestroy { this.getError().subscribe(e => { if (e !== null) { // setTimeout(() => this.showError('Error', e)); - setTimeout(() => this.shareNonExistentModal.show()); } + setTimeout(() => this.shareNonExistentModal.show()); + } }); // Query the API every 2 seconds diff --git a/web/angular/src/assets/img/marker_normal.png b/web/angular/src/assets/img/marker_normal.png new file mode 100644 index 0000000..01f2f91 Binary files /dev/null and b/web/angular/src/assets/img/marker_normal.png differ