Reload map when adding packages (fixes glitch), adjust max zoom
This commit is contained in:
parent
6b1f3a1486
commit
980abf000e
@ -25,7 +25,7 @@ function addPackage(address, latitude, longitude) {
|
||||
});
|
||||
|
||||
if (map != null) {
|
||||
map.updatePackageLayer(packages);
|
||||
reloadMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,19 @@ function createMap() {
|
||||
map.updatePackageLayer(packages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy and re-create the map.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function reloadMap() {
|
||||
if (map != null) {
|
||||
map.off();
|
||||
map.remove();
|
||||
map = null;
|
||||
}
|
||||
createMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the toggle button on the popup sheet do things
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@ function leafletMap() {
|
||||
var map = L.map('mapbox', {
|
||||
zoomSnap: 0.25,
|
||||
minZoom: 1,
|
||||
maxZoom: 20,
|
||||
maxZoom: 19,
|
||||
zoom: 12,
|
||||
center: L.latLng(46.5966, -112.0180),
|
||||
attributionControl: true,
|
||||
@ -36,7 +36,7 @@ function leafletMap() {
|
||||
} else {
|
||||
L.tileLayer(mapSources[localStorage.getItem("mapsource")], {
|
||||
minZoom: 1,
|
||||
maxZoom: 20
|
||||
maxZoom: 19
|
||||
}).addTo(map);
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,7 @@ function confirmDeletePackage(id) {
|
||||
"Confirm",
|
||||
function () {
|
||||
// delete
|
||||
packages.splice(id, 1);
|
||||
localStorage.setItem("packages", JSON.stringify(packages));
|
||||
loadPackageList();
|
||||
deletePackage(id);
|
||||
},
|
||||
function () {
|
||||
// cancel
|
||||
|
Loading…
x
Reference in New Issue
Block a user