diff --git a/apps.json b/apps.json index e250da0f6..1f6314f74 100644 --- a/apps.json +++ b/apps.json @@ -1099,7 +1099,7 @@ "name": "OpenStreetMap", "shortName":"OpenStMap", "icon": "app.png", - "version":"0.01", + "version":"0.02", "description": "[BETA] Loads map tiles from OpenStreetMap onto your Bangle.js and displays a map of where you are", "tags": "outdoors,gps", "custom": "custom.html", @@ -1118,7 +1118,7 @@ "storage": [ {"name":"tabata.app.js","url":"tabata.js"}, {"name":"tabata.img","url":"tabata-icon.js","evaluate":true} - ] + ] }, { "id": "custom", "name": "Custom Boot Code ", diff --git a/apps/openstmap/ChangeLog b/apps/openstmap/ChangeLog index 5560f00bc..2d60cb688 100644 --- a/apps/openstmap/ChangeLog +++ b/apps/openstmap/ChangeLog @@ -1 +1,2 @@ 0.01: New App! +0.02: Fix marker position, color, and map scaling diff --git a/apps/openstmap/app.js b/apps/openstmap/app.js index ec6dfdfd9..ae4817f16 100644 --- a/apps/openstmap/app.js +++ b/apps/openstmap/app.js @@ -28,14 +28,24 @@ function redraw() { } } } - g.setColor(1,0,0); - /*g.fillRect(cx-10,cy-1,cx+10,cy+1); - g.fillRect(cx-1,cy-10,cx+1,cy+10);*/ - if (fix.fix) - g.fillRect(cx-2,cy-2,cx+2,cy+2); + drawMarker(); } + +function drawMarker() { + if (!fix.fix) return; + var p = Bangle.project({lat:lat,lon:lon}); + var q = Bangle.project(fix); + var cx = g.getWidth()/2; + var cy = g.getHeight()/2; + var ix = (q.x-p.x)*4096/map.scale + cx; + var iy = cy - (q.y-p.y)*4096/map.scale; + g.setColor(1,0,0); + g.fillRect(ix-2,iy-2,ix+2,iy+2); +} + redraw(); + var fix; Bangle.on('GPS',function(f) { fix=f; @@ -47,15 +57,7 @@ Bangle.on('GPS',function(f) { if (!fix.fix) txt += " - NO FIX"; g.drawString(txt,120,4); - if (fix.fix) { - var p = Bangle.project({lat:lat,lon:lon}); - var q = Bangle.project(fix); - var cx = g.getWidth()/2; - var cy = g.getHeight()/2; - var ix = (q.x-p.x)*4096/map.scale + cx; - var iy = (q.y-p.y)*4096/map.scale + cy; - g.fillRect(ix-2,iy-2,ix+2,iy+2); - } + drawMarker(); }); Bangle.setGPSPower(1); redraw(); diff --git a/apps/openstmap/custom.html b/apps/openstmap/custom.html index cac95a94e..1b7cfada4 100644 --- a/apps/openstmap/custom.html +++ b/apps/openstmap/custom.html @@ -32,9 +32,10 @@
Zoom in to the area you want as a map
-Click
- +