|
|
|
@ -7,6 +7,14 @@
|
|
|
|
|
|
|
|
|
|
var gotfirstfix = false;
|
|
|
|
|
|
|
|
|
|
var playerPosition = {
|
|
|
|
|
coords: {
|
|
|
|
|
latitude: 0.0,
|
|
|
|
|
longitude: 0.0,
|
|
|
|
|
accuracy: 999999
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var geoerrorcount = 0;
|
|
|
|
|
|
|
|
|
|
var gamemaptype = "mapbox";
|
|
|
|
@ -29,19 +37,20 @@ watchLocation(function (position) {
|
|
|
|
|
animateMapIn(position.coords.latitude, position.coords.longitude, 16, position.coords.heading);
|
|
|
|
|
gotfirstfix = true;
|
|
|
|
|
}
|
|
|
|
|
playerPosition = position;
|
|
|
|
|
}, function (error) {
|
|
|
|
|
geoerrorcount++;
|
|
|
|
|
console.log("Geolocation error #" + geoerrorcount + ": ", error);
|
|
|
|
|
// Stop showing error toasts if they're happening a lot
|
|
|
|
|
if (geoerrorcount > 3) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
app.toast.show({
|
|
|
|
|
text: '<i class="fas fa-compass"></i> ' + error,
|
|
|
|
|
position: "bottom",
|
|
|
|
|
destroyOnClose: true,
|
|
|
|
|
closeTimeout: 1000 * 4
|
|
|
|
|
});
|
|
|
|
|
// if (geoerrorcount > 3) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// app.toast.show({
|
|
|
|
|
// text: '<i class="fas fa-compass"></i> ' + error,
|
|
|
|
|
// position: "bottom",
|
|
|
|
|
// destroyOnClose: true,
|
|
|
|
|
// closeTimeout: 1000 * 4
|
|
|
|
|
// });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function setMapHeading(heading) {
|
|
|
|
@ -58,7 +67,7 @@ function updatePlaceLayer(latitude, longitude) {
|
|
|
|
|
password: localStorage.getItem("password"),
|
|
|
|
|
latitude: latitude,
|
|
|
|
|
longitude: longitude,
|
|
|
|
|
radius: 0.5
|
|
|
|
|
radius: 1
|
|
|
|
|
}, function (data) {
|
|
|
|
|
map.updatePlaceLayer(data);
|
|
|
|
|
});
|
|
|
|
|