forked from FOSS/BangleApps
recorder/openstmap 0.31: Ensure that background-drawn tracks can get cancelled, and draw less at a time to make updates smoother
plotTrack now draws the current track even if you're not actively recordingmaster
parent
1ec0b94362
commit
8a4a2cee5a
|
@ -29,4 +29,5 @@
|
||||||
0.22: Replace position marker with direction arrow
|
0.22: Replace position marker with direction arrow
|
||||||
0.23: Bugfix: Enable Compass if needed
|
0.23: Bugfix: Enable Compass if needed
|
||||||
0.24: Allow zooming by clicking the screen
|
0.24: Allow zooming by clicking the screen
|
||||||
0.25: Enable scaled image filtering on 2v19+ firmware
|
0.25: Enable scaled image filtering on 2v19+ firmware
|
||||||
|
0.26: Ensure that when redrawing, we always cancel any in-progress track draw
|
|
@ -30,6 +30,10 @@ if (settings.dirSrc === undefined) {
|
||||||
|
|
||||||
// Redraw the whole page
|
// Redraw the whole page
|
||||||
function redraw() {
|
function redraw() {
|
||||||
|
// ensure we do cancel track drawing
|
||||||
|
if (plotTrack && plotTrack.stop)
|
||||||
|
plotTrack.stop();
|
||||||
|
// set clip rect so we don't overwrite widgets
|
||||||
g.setClipRect(R.x,R.y,R.x2,R.y2);
|
g.setClipRect(R.x,R.y,R.x2,R.y2);
|
||||||
const count = m.draw();
|
const count = m.draw();
|
||||||
if (checkMapPos && count === 0) {
|
if (checkMapPos && count === 0) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "openstmap",
|
"id": "openstmap",
|
||||||
"name": "OpenStreetMap",
|
"name": "OpenStreetMap",
|
||||||
"shortName": "OpenStMap",
|
"shortName": "OpenStMap",
|
||||||
"version": "0.25",
|
"version": "0.26",
|
||||||
"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",
|
||||||
|
|
|
@ -36,3 +36,5 @@
|
||||||
0.28: Automatically create new track if the filename is different
|
0.28: Automatically create new track if the filename is different
|
||||||
0.29: When plotting with OpenStMap scale map to track width & height
|
0.29: When plotting with OpenStMap scale map to track width & height
|
||||||
0.30: Add clock info for showing and toggling recording state
|
0.30: Add clock info for showing and toggling recording state
|
||||||
|
0.31: Ensure that background-drawn tracks can get cancelled, and draw less at a time to make updates smoother
|
||||||
|
plotTrack now draws the current track even if you're not actively recording
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "recorder",
|
"id": "recorder",
|
||||||
"name": "Recorder",
|
"name": "Recorder",
|
||||||
"shortName": "Recorder",
|
"shortName": "Recorder",
|
||||||
"version": "0.30",
|
"version": "0.31",
|
||||||
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
|
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "tool,outdoors,gps,widget,clkinfo",
|
"tags": "tool,outdoors,gps,widget,clkinfo",
|
||||||
|
|
|
@ -288,8 +288,8 @@
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
options = options||{};
|
options = options||{};
|
||||||
if (!activeRecorders.length) return; // not recording
|
|
||||||
var settings = loadSettings();
|
var settings = loadSettings();
|
||||||
|
if (!settings.file) return; // no file specified
|
||||||
// keep function to draw track in RAM
|
// keep function to draw track in RAM
|
||||||
function plot(g) { "ram";
|
function plot(g) { "ram";
|
||||||
var f = require("Storage").open(settings.file,"r");
|
var f = require("Storage").open(settings.file,"r");
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
mp = m.latLonToXY(+c[la], +c[lo]);
|
mp = m.latLonToXY(+c[la], +c[lo]);
|
||||||
g.moveTo(mp.x,mp.y).setColor(color);
|
g.moveTo(mp.x,mp.y).setColor(color);
|
||||||
l = f.readLine(f);
|
l = f.readLine(f);
|
||||||
var n = options.async ? 20 : 200; // only plot first 200 points to keep things fast(ish)
|
var n = options.async ? 10 : 200; // only plot first 200 points to keep things fast(ish)
|
||||||
while(l && n--) {
|
while(l && n--) {
|
||||||
c = l.split(",");
|
c = l.split(",");
|
||||||
if (c[la]) {
|
if (c[la]) {
|
||||||
|
@ -333,7 +333,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
plot(g);
|
return plot(g);
|
||||||
}};
|
}};
|
||||||
// load settings, set correct widget width
|
// load settings, set correct widget width
|
||||||
reload();
|
reload();
|
||||||
|
|
Loading…
Reference in New Issue