Changing the marker style and make it adjust properly to the zoom level.
lbs-gitea/maptology/master There was a failure building this commit

This commit is contained in:
Sebastian Roehl
2018-01-15 13:48:13 +01:00
parent 2ddc42e8c7
commit a4dee46739
2 changed files with 15 additions and 3 deletions
@@ -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
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB