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
|
|
@ -19,3 +19,4 @@
|
||||||
0.16: Draw waypoints, too.
|
0.16: Draw waypoints, too.
|
||||||
0.17: With new Recorder app allow track to be drawn in the background
|
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);
|
}).addTo(map);
|
||||||
let marker = new L.marker(latlon).addTo(map);
|
let marker = new L.marker(latlon).addTo(map);
|
||||||
map.fitBounds(latlon.toBounds(2000/*meters*/), {animation: false});
|
map.fitBounds(latlon.toBounds(2000/*meters*/), {animation: false});
|
||||||
}, 100);
|
}, 500);
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "openstmap",
|
"id": "openstmap",
|
||||||
"name": "OpenStreetMap",
|
"name": "OpenStreetMap",
|
||||||
"shortName": "OpenStMap",
|
"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",
|
"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",
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ m.maps = require("Storage").list(/openstmap\.\d+\.json/).map(f=>{
|
||||||
map.center = Bangle.project({lat:map.lat,lon:map.lon});
|
map.center = Bangle.project({lat:map.lat,lon:map.lon});
|
||||||
return map;
|
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
|
// we base our start position on the middle of the first map
|
||||||
m.map = m.maps[0];
|
m.map = m.maps[0];
|
||||||
m.scale = m.map.scale; // current scale (based on first map)
|
m.scale = m.map.scale; // current scale (based on first map)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue