Merge pull request #2844 from nxdefiant/master

openstmap & recorder changes
master
Gordon Williams 2023-06-28 11:59:36 +01:00 committed by GitHub
commit 2cd1caa2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 5 deletions

View File

@ -19,3 +19,4 @@
0.16: Draw waypoints, too.
0.17: With new Recorder app allow track to be drawn in the background
Switch tile layer URL for faster/more reliable map tiles
0.18: Prefer map with highest resolution

View File

@ -183,7 +183,7 @@ TODO:
}).addTo(map);
let marker = new L.marker(latlon).addTo(map);
map.fitBounds(latlon.toBounds(2000/*meters*/), {animation: false});
}, 100);
}, 500);
}
resolve();
});

View File

@ -2,7 +2,7 @@
"id": "openstmap",
"name": "OpenStreetMap",
"shortName": "OpenStMap",
"version": "0.17",
"version": "0.18",
"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",

View File

@ -30,6 +30,7 @@ m.maps = require("Storage").list(/openstmap\.\d+\.json/).map(f=>{
map.center = Bangle.project({lat:map.lat,lon:map.lon});
return map;
});
m.maps.sort((a,b) => b.scale-a.scale); // sort by scale so highest resolution is drawn last
// we base our start position on the middle of the first map
m.map = m.maps[0];
m.scale = m.map.scale; // current scale (based on first map)

View File

@ -34,3 +34,4 @@
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.29: When plotting with OpenStMap scale map to track width & height

View File

@ -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"

View File

@ -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",