From 05c217570b27ee69eaa73af8b88383955c56bde8 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Mon, 19 Dec 2011 00:35:33 +0100 Subject: [PATCH] add centering on track position --- js/map.js | 7 +++++++ 1 file changed, 7 insertions(+) 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. -- 2.43.0