click twice for more gps precision

This commit is contained in:
Ted Unangst 2019-09-28 16:24:55 -04:00
parent 35b57951e7
commit ae2b456727
1 changed files with 4 additions and 3 deletions

View File

@ -202,16 +202,17 @@ function updatedonker() {
var el = document.getElementById("donkdescriptor") var el = document.getElementById("donkdescriptor")
el.style.display = "" el.style.display = ""
} }
var checkinprec = 500.0
function fillcheckin() { function fillcheckin() {
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(pos) { navigator.geolocation.getCurrentPosition(function(pos) {
var precision = 500.0
var el = document.getElementById("placedescriptor") var el = document.getElementById("placedescriptor")
el.style.display = "block" el.style.display = "block"
el = document.getElementById("placelatinput") el = document.getElementById("placelatinput")
el.value = Math.round(pos.coords.latitude * precision) / precision el.value = Math.round(pos.coords.latitude * checkinprec) / checkinprec
el = document.getElementById("placelonginput") el = document.getElementById("placelonginput")
el.value = Math.round(pos.coords.longitude * precision) / precision el.value = Math.round(pos.coords.longitude * checkinprec) / checkinprec
checkinprec = 10000.0
}, function(err) { }, function(err) {
var el = document.getElementById("placedescriptor") var el = document.getElementById("placedescriptor")
el.style.display = "block" el.style.display = "block"