Skip to content
Snippets Groups Projects
Commit c67bb2b3 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Wenn die Positionsdaten aktualisiert werden zentriert sich die Karte nun zwar...

Wenn die Positionsdaten aktualisiert werden zentriert sich die Karte nun zwar weiterhin auf den Punkt, stellt den Zoom aber so ein, dass die gesamte Genauigkeit zu sehen ist.
parent cf39d8a4
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -200,10 +200,6 @@ function followLocation(){ ...@@ -200,10 +200,6 @@ function followLocation(){
if(id === null){ if(id === null){
id = navigator.geolocation.watchPosition(function(position) { id = navigator.geolocation.watchPosition(function(position) {
// Set the Center of the map to the given Location:
centerMap(position.coords.longitude,position.coords.latitude);
map.getView().setZoom(18);
// Remove possibly existing User-Location Marker: // Remove possibly existing User-Location Marker:
if(userPositionMarker !== null){ if(userPositionMarker !== null){
map.removeLayer(userPositionMarker); map.removeLayer(userPositionMarker);
...@@ -231,6 +227,8 @@ function followLocation(){ ...@@ -231,6 +227,8 @@ function followLocation(){
}); });
map.addLayer(userPositionMarker); map.addLayer(userPositionMarker);
// Fit the Extent of the Map to Fit the new Features Exactly
map.getView().fitExtent(userPositionMarker.getSource().getExtent(), map.getSize());
// Change the color of the Icon so the user knows that the position is tracked: // Change the color of the Icon so the user knows that the position is tracked:
$("#follow-location").css("color", "#2881cc"); $("#follow-location").css("color", "#2881cc");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment