Add map scale control
This commit is contained in:
parent
2736bd3c6e
commit
5f81dd876e
@ -46,6 +46,14 @@ function mapboxMap() {
|
|||||||
}), 'top-left'
|
}), 'top-left'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (getStorage("mapscale") !== "false") {
|
||||||
|
map.addControl(
|
||||||
|
new mapboxgl.ScaleControl({
|
||||||
|
unit: getStorage("units") == "imperial" ? "imperial" : "metric"
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
map.startLocateControl = function () {
|
map.startLocateControl = function () {
|
||||||
// stub
|
// stub
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,13 @@ $('.item-link[data-setting=mapsource] select').on("change", function () {
|
|||||||
reloadMap();
|
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 () {
|
$('.item-content[data-setting=maptype] .toggle input').on("change", function () {
|
||||||
var checked = $(this).prop('checked');
|
var checked = $(this).prop('checked');
|
||||||
setStorage("maptype", checked ? "leaflet" : "mapbox");
|
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",
|
setting: "maptype",
|
||||||
title: "Alternative map",
|
title: "Alternative map",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user