Add setting to change the map zoom level when location is being tracked
This commit is contained in:
parent
b50524903d
commit
91e31c449e
@ -13,7 +13,7 @@ function leafletMap() {
|
|||||||
center: L.latLng(46.5966, -112.0180),
|
center: L.latLng(46.5966, -112.0180),
|
||||||
attributionControl: false
|
attributionControl: false
|
||||||
});
|
});
|
||||||
|
|
||||||
map.maptype = "leaflet";
|
map.maptype = "leaflet";
|
||||||
|
|
||||||
if (localStorage.getItem("mapsource") == null) {
|
if (localStorage.getItem("mapsource") == null) {
|
||||||
@ -32,7 +32,7 @@ function leafletMap() {
|
|||||||
showPopup: false,
|
showPopup: false,
|
||||||
locateOptions: {
|
locateOptions: {
|
||||||
enableHighAccuracy: true,
|
enableHighAccuracy: true,
|
||||||
maxZoom: 16
|
maxZoom: localStorage.getItem("trackzoom") == null ? 16 : localStorage.getItem("trackzoom")
|
||||||
},
|
},
|
||||||
setView: "untilPanOrZoom",
|
setView: "untilPanOrZoom",
|
||||||
icon: "far fa-compass",
|
icon: "far fa-compass",
|
||||||
|
@ -29,7 +29,9 @@ function mapboxMap() {
|
|||||||
|
|
||||||
map.maptype = "mapbox";
|
map.maptype = "mapbox";
|
||||||
|
|
||||||
map.addControl(new mapboxgl.NavigationControl());
|
map.addControl(new mapboxgl.NavigationControl({
|
||||||
|
visualizePitch: true
|
||||||
|
}));
|
||||||
|
|
||||||
map.addControl(
|
map.addControl(
|
||||||
new mapboxgl.GeolocateControl({
|
new mapboxgl.GeolocateControl({
|
||||||
@ -38,7 +40,7 @@ function mapboxMap() {
|
|||||||
timeout: 10 * 1000
|
timeout: 10 * 1000
|
||||||
},
|
},
|
||||||
fitBoundsOptions: {
|
fitBoundsOptions: {
|
||||||
maxZoom: 16
|
maxZoom: localStorage.getItem("trackzoom") == null ? 16 : localStorage.getItem("trackzoom")
|
||||||
},
|
},
|
||||||
trackUserLocation: true
|
trackUserLocation: true
|
||||||
})
|
})
|
||||||
|
@ -21,6 +21,10 @@ $('.item-link[data-setting=units] select').on("change", function () {
|
|||||||
localStorage.setItem("units", $('.item-link[data-setting=units] select').val());
|
localStorage.setItem("units", $('.item-link[data-setting=units] select').val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.item-link[data-setting=trackzoom] select').on("change", function () {
|
||||||
|
localStorage.setItem("trackzoom", $('.item-link[data-setting=trackzoom] select').val());
|
||||||
|
});
|
||||||
|
|
||||||
$('.item-content[data-setting=wakelock] .toggle input').on("change", function () {
|
$('.item-content[data-setting=wakelock] .toggle input').on("change", function () {
|
||||||
var checked = $(this).prop('checked');
|
var checked = $(this).prop('checked');
|
||||||
console.log(checked);
|
console.log(checked);
|
||||||
|
@ -373,6 +373,28 @@ var routes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
setting: "trackzoom",
|
||||||
|
title: "Zoom when tracking location",
|
||||||
|
select: true,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
value: 15,
|
||||||
|
label: "Low",
|
||||||
|
selected: localStorage.getItem("trackzoom") == 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 16,
|
||||||
|
label: "Normal",
|
||||||
|
selected: localStorage.getItem("trackzoom") == null || localStorage.getItem("trackzoom") == 16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 17,
|
||||||
|
label: "High",
|
||||||
|
selected: localStorage.getItem("trackzoom") == 17
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
setting: "maptype",
|
setting: "maptype",
|
||||||
title: "Alternative map",
|
title: "Alternative map",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user