From 879c1e6f2510e203ee38089a61598887d18d63e5 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Sun, 19 Apr 2015 17:02:43 +0200 Subject: [PATCH] map: store zoom/center instead of bounds --- lib/map.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/map.js b/lib/map.js index a6e1468..ef7a74c 100644 --- a/lib/map.js +++ b/lib/map.js @@ -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() }