This commit is contained in:
@@ -80,12 +80,6 @@ export class MapComponent implements OnInit, OnDestroy {
|
||||
// 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) {
|
||||
@@ -104,16 +98,9 @@ export class MapComponent implements OnInit, OnDestroy {
|
||||
// Query the API every 2 seconds
|
||||
this.refreshInterval = setInterval(() => {
|
||||
this.locationService.getLocation(this.currentShare);
|
||||
this.setMapPosition(this.locationService.location.getValue(), 10);
|
||||
}, 2000);
|
||||
|
||||
// subscribe to location updates
|
||||
this.locationService.location.subscribe(location => {
|
||||
this.consoleService.log('Lon: ' + location.coordinate.longitude + ' Lat: ' + location.coordinate.latitude);
|
||||
if (location !== null) {
|
||||
this.setMapPosition(location, 10);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
setTimeout(() => this.showWarning('Warning', 'URL does not contain a valid share!'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user