openstmap: sort maps by scale desc
This results in the map with the highest resolution (lowest scale) to be drawn lastmaster
parent
4dd4a17511
commit
bf58db6a31
|
|
@ -18,4 +18,5 @@
|
|||
0.15: Make track drawing an option (default off)
|
||||
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
|
||||
Switch tile layer URL for faster/more reliable map tiles
|
||||
0.18: Prefer map with highest resolution
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue