Fix button behaviours attempt no 2
This commit is contained in:
parent
ecb1875077
commit
0b5e82dfc4
1 changed files with 17 additions and 15 deletions
|
@ -91,24 +91,26 @@
|
||||||
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) {
|
||||||
map.fitBounds(
|
if (this.coords) {
|
||||||
L.latLng(this.coords.latitude, this.coords.longitude).toBounds(this.coords.accuracy * 2),
|
map.fitBounds(
|
||||||
{
|
L.latLng(this.coords.latitude, this.coords.longitude).toBounds(this.coords.accuracy * 2),
|
||||||
|
{
|
||||||
|
animate: true,
|
||||||
|
duration: 1,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
map.setZoom(1, {
|
||||||
animate: true,
|
animate: true,
|
||||||
duration: 1,
|
duration: 5,
|
||||||
},
|
});
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue