|
|
@ -91,17 +91,12 @@ |
|
|
|
follow: false, |
|
|
|
follow: false, |
|
|
|
coords: void 0, |
|
|
|
coords: void 0, |
|
|
|
setFollow: function(shouldFollow: boolean) { |
|
|
|
setFollow: function(shouldFollow: boolean) { |
|
|
|
if (this.follow && !shouldFollow) { |
|
|
|
|
|
|
|
map.setZoom(1, { |
|
|
|
|
|
|
|
animate: true, |
|
|
|
|
|
|
|
duration: 5, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.follow = shouldFollow; |
|
|
|
this.follow = shouldFollow; |
|
|
|
}, |
|
|
|
}, |
|
|
|
update: function(coords: GeolocationCoordinates) { |
|
|
|
update: function(coords: GeolocationCoordinates | undefined) { |
|
|
|
this.coords = coords; |
|
|
|
this.coords = coords; |
|
|
|
if (this.coords && this.follow) { |
|
|
|
if (map && this.follow) { |
|
|
|
|
|
|
|
if (this.coords) { |
|
|
|
map.fitBounds( |
|
|
|
map.fitBounds( |
|
|
|
L.latLng(this.coords.latitude, this.coords.longitude).toBounds(this.coords.accuracy * 2), |
|
|
|
L.latLng(this.coords.latitude, this.coords.longitude).toBounds(this.coords.accuracy * 2), |
|
|
|
{ |
|
|
|
{ |
|
|
@ -110,6 +105,13 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
map.setZoom(1, { |
|
|
|
|
|
|
|
animate: true, |
|
|
|
|
|
|
|
duration: 5, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|