map: various small fixes

This commit is contained in:
Nils Schneider 2015-07-07 21:42:55 +02:00
parent 02a03e5a61
commit ec49c9d59b

View file

@ -198,11 +198,6 @@ define(["map/clientlayer", "map/labelslayer",
layerControl.addBaseLayer(layer, layerName)
customLayers.add(layerName)
if (!layerControl.added) {
layerControl.addTo(map)
layerControl.added = true
}
if (localStorageTest())
localStorage.setItem("map/customLayers", JSON.stringify(Array.from(customLayers)))
} catch (e) {
@ -242,6 +237,7 @@ define(["map/clientlayer", "map/labelslayer",
}))
layerControl = L.control.layers(baseLayers, [], {position: "bottomright"})
layerControl.addTo(map)
if (localStorageTest()) {
var d = JSON.parse(localStorage.getItem("map/customLayers"))
@ -277,6 +273,7 @@ define(["map/clientlayer", "map/labelslayer",
}
function resetZoom() {
if (barycenter)
setView(barycenter.getBounds())
}
@ -321,6 +318,10 @@ define(["map/clientlayer", "map/labelslayer",
function calcBarycenter(nodes) {
nodes = nodes.map(function (d) { return d.nodeinfo.location })
if (nodes.length === 0)
return undefined
var lats = nodes.map(function (d) { return d.latitude })
var lngs = nodes.map(function (d) { return d.longitude })