mirror of https://github.com/espruino/BangleApps
recorder: set scale on OpenStMap plot
When plotting with OpenStMap scale map to track width & heightpull/2844/head
parent
c67964bf61
commit
bb598bbb6c
|
@ -33,4 +33,5 @@
|
|||
0.25: Widget now has `isRecording()` for retrieving recording status.
|
||||
0.26: Now record filename based on date
|
||||
0.27: Fix first ever recorded filename being log0 (now all are dated)
|
||||
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
|
||||
|
|
|
@ -224,6 +224,12 @@ function viewTrack(filename, info) {
|
|||
// Function to convert lat/lon to XY
|
||||
var getMapXY;
|
||||
if (info.qOSTM) {
|
||||
// scale map to view full track
|
||||
const max = Bangle.project({lat: info.maxLat, lon: info.maxLong});
|
||||
const min = Bangle.project({lat: info.minLat, lon: info.minLong});
|
||||
const scaleX = (max.x-min.x)/Bangle.appRect.w;
|
||||
const scaleY = (max.y-min.y)/Bangle.appRect.h;
|
||||
osm.scale = Math.ceil((scaleX > scaleY ? scaleX : scaleY)*1.1); // add 10% margin
|
||||
getMapXY = osm.latLonToXY.bind(osm);
|
||||
} else {
|
||||
getMapXY = function(lat, lon) { "ram"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "recorder",
|
||||
"name": "Recorder",
|
||||
"shortName": "Recorder",
|
||||
"version": "0.28",
|
||||
"version": "0.29",
|
||||
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,outdoors,gps,widget",
|
||||
|
|
Loading…
Reference in New Issue