1
0
Fork 0

openstmap 0.15: Make track drawing an option (default off)

master
Gordon Williams 2022-11-28 11:16:36 +00:00
parent 6e66e57098
commit eba77c8a99
4 changed files with 25 additions and 10 deletions

View File

@ -15,3 +15,4 @@
0.14: Added ability to upload multiple sets of map tiles 0.14: Added ability to upload multiple sets of map tiles
Support for zooming in on map Support for zooming in on map
Satellite count moved to widget bar to leave more room for the map Satellite count moved to widget bar to leave more room for the map
0.15: Make track drawing an option (default off)

View File

@ -26,11 +26,16 @@ can change settings, move the map around, and click `Get Map` again.
## Bangle.js App ## Bangle.js App
The Bangle.js app allows you to view a map - it also turns the GPS on and marks 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 * Drag on the screen to move the map
* Press the button to bring up a menu, where you can zoom, go to GPS location * 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 ## Library

View File

@ -4,12 +4,15 @@ var R;
var fix = {}; var fix = {};
var mapVisible = false; var mapVisible = false;
var hasScrolled = false; var hasScrolled = false;
var settings = require("Storage").readJSON("openstmap.json",1)||{};
// Redraw the whole page // Redraw the whole page
function redraw() { function redraw() {
g.setClipRect(R.x,R.y,R.x2,R.y2); g.setClipRect(R.x,R.y,R.x2,R.y2);
m.draw(); m.draw();
drawMarker(); drawMarker();
// if track drawing is enabled...
if (settings.drawTrack) {
if (HASWIDGETS && WIDGETS["gpsrec"] && WIDGETS["gpsrec"].plotTrack) { if (HASWIDGETS && WIDGETS["gpsrec"] && WIDGETS["gpsrec"].plotTrack) {
g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later
WIDGETS["gpsrec"].plotTrack(m); WIDGETS["gpsrec"].plotTrack(m);
@ -18,6 +21,7 @@ function redraw() {
g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later
WIDGETS["recorder"].plotTrack(m); WIDGETS["recorder"].plotTrack(m);
} }
}
g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1); g.setClipRect(0,0,g.getWidth()-1,g.getHeight()-1);
} }
@ -76,6 +80,10 @@ function showMap() {
m.scale *= 2; m.scale *= 2;
showMap(); showMap();
}, },
/*LANG*/"Draw Track": {
value : !!settings.drawTrack,
onchange : v => { settings.drawTrack=v; require("Storage").writeJSON("openstmap.json",settings); }
},
/*LANG*/"Center Map": () =>{ /*LANG*/"Center Map": () =>{
m.lat = m.map.lat; m.lat = m.map.lat;
m.lon = m.map.lon; m.lon = m.map.lon;

View File

@ -2,7 +2,7 @@
"id": "openstmap", "id": "openstmap",
"name": "OpenStreetMap", "name": "OpenStreetMap",
"shortName": "OpenStMap", "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", "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", "readme": "README.md",
"icon": "app.png", "icon": "app.png",
@ -15,6 +15,7 @@
{"name":"openstmap.app.js","url":"app.js"}, {"name":"openstmap.app.js","url":"app.js"},
{"name":"openstmap.img","url":"app-icon.js","evaluate":true} {"name":"openstmap.img","url":"app-icon.js","evaluate":true}
], "data": [ ], "data": [
{"name":"openstmap.json"},
{"wildcard":"openstmap.*.json"}, {"wildcard":"openstmap.*.json"},
{"wildcard":"openstmap.*.img"} {"wildcard":"openstmap.*.img"}
] ]