map: store zoom/center instead of bounds

This commit is contained in:
Nils Schneider 2015-04-19 17:02:43 +02:00
parent ba9cc703d7
commit 879c1e6f25

View file

@ -122,7 +122,7 @@ define(["map/clientlayer", "map/labelslayer",
var self = this
var barycenter
var groupOnline, groupOffline, groupNew, groupLost, groupLines
var savedBounds
var savedView
var map, userLocation
var layerControl
@ -136,7 +136,8 @@ define(["map/clientlayer", "map/labelslayer",
})
function saveView() {
savedBounds = map.getBounds()
savedView = {center: map.getCenter(),
zoom: map.getZoom()}
}
function enableTracking() {
@ -286,8 +287,8 @@ define(["map/clientlayer", "map/labelslayer",
if (!nopanzoom)
if (m)
goto(m)
else if (savedBounds)
map.fitBounds(savedBounds)
else if (savedView)
map.setView(savedView.center, savedView.zoom)
else
resetZoom()
}