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