Add map scale control

Skylar Ittner 4 years ago
parent 2736bd3c6e
commit 5f81dd876e

@ -46,6 +46,14 @@ function mapboxMap() {
}), 'top-left'
);
if (getStorage("mapscale") !== "false") {
map.addControl(
new mapboxgl.ScaleControl({
unit: getStorage("units") == "imperial" ? "imperial" : "metric"
})
);
}
map.startLocateControl = function () {
// stub
}

@ -102,6 +102,13 @@ $('.item-link[data-setting=mapsource] select').on("change", function () {
reloadMap();
});
$('.item-content[data-setting=mapscale] .toggle input').on("change", function () {
var checked = $(this).prop('checked');
setStorage("mapscale", checked ? "true" : "false");
reloadMap();
});
$('.item-content[data-setting=maptype] .toggle input').on("change", function () {
var checked = $(this).prop('checked');
setStorage("maptype", checked ? "leaflet" : "mapbox");

@ -541,6 +541,14 @@ var routes = [
}
]
},
{
setting: "mapscale",
title: "Map Scale Ruler",
text: "Show a scale in the corner of the map.",
toggle: true,
checked: localStorage.getItem("mapscale") !== "false",
onclick: ""
},
{
setting: "maptype",
title: "Alternative map",

Loading…
Cancel
Save