diff --git a/apps/openstmap/ChangeLog b/apps/openstmap/ChangeLog index 7f22014ae..7f788c139 100644 --- a/apps/openstmap/ChangeLog +++ b/apps/openstmap/ChangeLog @@ -15,3 +15,4 @@ 0.14: Added ability to upload multiple sets of map tiles Support for zooming in on map Satellite count moved to widget bar to leave more room for the map +0.15: Make track drawing an option (default off) diff --git a/apps/openstmap/README.md b/apps/openstmap/README.md index 707dbc7f8..f19b13bd1 100644 --- a/apps/openstmap/README.md +++ b/apps/openstmap/README.md @@ -26,11 +26,16 @@ can change settings, move the map around, and click `Get Map` again. ## Bangle.js App The Bangle.js app allows you to view a map - it also turns the GPS on and marks -the path that you've been travelling. +the path that you've been travelling (if enabled). * Drag on the screen to move the map * Press the button to bring up a menu, where you can zoom, go to GPS location -or put the map back in its default location +, put the map back in its default location, or choose whether to draw the currently +recording GPS track (from the `Recorder` app). + +**Note:** If enabled, drawing the currently recorded GPS track can take a second +or two (which happens after you've finished scrolling the screen with your finger). + ## Library diff --git a/apps/openstmap/app.js b/apps/openstmap/app.js index 9df4fa83f..89e2d2ddb 100644 --- a/apps/openstmap/app.js +++ b/apps/openstmap/app.js @@ -4,19 +4,23 @@ var R; var fix = {}; var mapVisible = false; var hasScrolled = false; +var settings = require("Storage").readJSON("openstmap.json",1)||{}; // Redraw the whole page function redraw() { g.setClipRect(R.x,R.y,R.x2,R.y2); m.draw(); drawMarker(); - if (HASWIDGETS && WIDGETS["gpsrec"] && WIDGETS["gpsrec"].plotTrack) { - g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later - WIDGETS["gpsrec"].plotTrack(m); - } - if (HASWIDGETS && WIDGETS["recorder"] && WIDGETS["recorder"].plotTrack) { - g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later - WIDGETS["recorder"].plotTrack(m); + // if track drawing is enabled... + if (settings.drawTrack) { + if (HASWIDGETS && WIDGETS["gpsrec"] && WIDGETS["gpsrec"].plotTrack) { + g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later + WIDGETS["gpsrec"].plotTrack(m); + } + if (HASWIDGETS && WIDGETS["recorder"] && WIDGETS["recorder"].plotTrack) { + g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later + WIDGETS["recorder"].plotTrack(m); + } } g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1); } @@ -76,6 +80,10 @@ function showMap() { m.scale *= 2; showMap(); }, + /*LANG*/"Draw Track": { + value : !!settings.drawTrack, + onchange : v => { settings.drawTrack=v; require("Storage").writeJSON("openstmap.json",settings); } + }, /*LANG*/"Center Map": () =>{ m.lat = m.map.lat; m.lon = m.map.lon; diff --git a/apps/openstmap/metadata.json b/apps/openstmap/metadata.json index 09b4c68e3..819dc4122 100644 --- a/apps/openstmap/metadata.json +++ b/apps/openstmap/metadata.json @@ -2,7 +2,7 @@ "id": "openstmap", "name": "OpenStreetMap", "shortName": "OpenStMap", - "version": "0.14", + "version": "0.15", "description": "Loads map tiles from OpenStreetMap onto your Bangle.js and displays a map of where you are. Once installed this also adds map functionality to `GPS Recorder` and `Recorder` apps", "readme": "README.md", "icon": "app.png", @@ -15,6 +15,7 @@ {"name":"openstmap.app.js","url":"app.js"}, {"name":"openstmap.img","url":"app-icon.js","evaluate":true} ], "data": [ + {"name":"openstmap.json"}, {"wildcard":"openstmap.*.json"}, {"wildcard":"openstmap.*.img"} ]