From: Robert Kaiser Date: Sun, 18 Dec 2011 23:35:33 +0000 (+0100) Subject: add centering on track position X-Git-Tag: legacy-preGL~86 X-Git-Url: https://git-public.kairo.at/?a=commitdiff_plain;h=05c217570b27ee69eaa73af8b88383955c56bde8;p=lantea.git add centering on track position --- diff --git a/js/map.js b/js/map.js index 3c12015..1ce6226 100644 --- a/js/map.js +++ b/js/map.js @@ -84,6 +84,7 @@ var gZoomTouchID; var gGeoWatchID; var gTrack = []; var gLastTrackPoint; +var gCenterPosition = true; function initMap() { gCanvas = document.getElementById("map"); @@ -415,6 +416,12 @@ function startTracking() { // Coords spec: https://developer.mozilla.org/en/XPCOM_Interface_Reference/NsIDOMGeoPositionCoords gTrack.push({time: position.timestamp, coords: position.coords}); drawTrackPoint(position.coords.latitude, position.coords.longitude); + if (gCenterPosition) { + var posCoord = gps2xy(position.coords.latitude, position.coords.longitude); + gPos.x = posCoord.x; + gPos.y = posCoord.y; + drawMap(); + } }, function(error) { // Ignore erros for the moment, but this is good for debugging.