add panTo-method to center view on marker-click
This commit is contained in:
parent
b484857746
commit
9afb135d91
@ -63,10 +63,11 @@ export class MapService {
|
||||
for (const station of data) {
|
||||
const marker = L.marker([station.lat, station.lon], {icon: createIcon});
|
||||
markerClusters.addLayer(marker);
|
||||
marker.on('click', e => e.target
|
||||
.bindPopup(this.popUpService.makeAvailabilityPopUp(station), {maxWidth: 'auto'})
|
||||
.openPopup()
|
||||
);
|
||||
marker.on('click', e => {
|
||||
e.target.bindPopup(this.popUpService.makeAvailabilityPopUp(station), {maxWidth: 'auto'})
|
||||
.openPopup();
|
||||
this.map.panTo(e.target.getLatLng());
|
||||
});
|
||||
marker.on('popupclose', e => e.target.unbindPopup());
|
||||
}
|
||||
}).catch((error) => {
|
||||
|
Loading…
Reference in New Issue
Block a user