Skip to content

Commit fe11fd7

Browse files
committed
openstmap 0.32: Move to non-deprecated track drawing using the recorder library
+ Add option to hide widgets
1 parent 91d8612 commit fe11fd7

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

apps/openstmap/ChangeLog

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@
3636
0.29: Keep exit at bottom of menu
3737
Speed up latLonToXY for track rendering
3838
0.30: Minor code improvements
39-
0.31: Reset draw colours before rendering (to allow black and white maps)
39+
0.31: Reset draw colours before rendering (to allow black and white maps)
40+
0.32: Move to non-deprecated track drawing using the recorder library
41+
Add option to hide widgets

apps/openstmap/app.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
var m = require("openstmap");
2-
var HASWIDGETS = true;
32
var R;
43
var fix = {};
54
var mapVisible = false;
65
var hasScrolled = false;
76
var settings = require("Storage").readJSON("openstmap.json",1)||{};
7+
var HASWIDGETS = !settings.noWidgets;
88
var plotTrack;
99
let checkMapPos = false; // Do we need to check the if the coordinates we have are valid
1010
var startDrag = 0;
11+
var hasRecorder = require("Storage").read("recorder")!=undefined; // do we have the recorder library?
1112

1213
if (Bangle.setLCDOverlay) {
1314
// Icon for current location+direction: https://icons8.com/icon/11932/gps 24x24, 1 Bit + transparency + inverted
@@ -53,9 +54,9 @@ function redraw() {
5354
g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later
5455
WIDGETS["gpsrec"].plotTrack(m);
5556
}
56-
if (HASWIDGETS && WIDGETS["recorder"] && WIDGETS["recorder"].plotTrack) {
57+
if (hasRecorder) {
5758
g.setColor("#f00").flip(); // force immediate draw on double-buffered screens - track will update later
58-
plotTrack = WIDGETS["recorder"].plotTrack(m, { async : true, callback : function() {
59+
plotTrack = require("recorder").plotTrack(m, { async : true, callback : function() {
5960
plotTrack = undefined;
6061
}});
6162
}
@@ -115,6 +116,7 @@ function drawLocation() {
115116
}
116117

117118
var p = m.latLonToXY(fix.lat, fix.lon);
119+
// TODO: if this is getting off the screen, we could adjust the map over? Also show marker to show what direction we're offscreen
118120

119121
ovLoc.clear();
120122
if (isInside(R, p, ovLoc.getWidth(), ovLoc.getHeight())) { // avoid drawing over widget area
@@ -196,8 +198,13 @@ function showMenu() {
196198
value : !!settings.drawMarker,
197199
onchange : v => { settings.drawMarker=v; writeSettings(); }
198200
},
201+
/*LANG*/"Hide Widgets": {
202+
value : !!settings.noWidgets,
203+
onchange : v => { settings.noWidgets=v; writeSettings(); load("openstmap.app.js"); }
204+
},
199205
});
200206

207+
201208
if (Bangle.setLCDOverlay) {
202209
menu[/*LANG*/"Direction source"] = {
203210
value: settings.dirSrc,

apps/openstmap/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "openstmap",
33
"name": "OpenStreetMap",
44
"shortName": "OpenStMap",
5-
"version": "0.31",
5+
"version": "0.32",
66
"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",
77
"readme": "README.md",
88
"icon": "app.png",

0 commit comments

Comments
 (0)