aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-03-14 18:25:06 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-03-14 18:25:06 +0000
commitb3207a4c049a4629229f693d27838d8673baa27a (patch)
tree1ab515161e529e1f66ad621e10e00f31637660f7 /web/js/map-OpenLayers.js
parenta11553fd048ec83697e785625b579d604cad21cb (diff)
Manually call setCenter rather than zoomToExtent, so that can force zoom event trigger. Fixes centering of area on area pages, I think.
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r--web/js/map-OpenLayers.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 89c862847..3d2d3259a 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -54,7 +54,10 @@ function fixmystreet_onload() {
fixmystreet.map.addLayer(area);
area.events.register('loadend', null, function(a,b,c) {
var bounds = area.getDataExtent();
- if (bounds) { fixmystreet.map.zoomToExtent( bounds ); }
+ if (bounds) {
+ var center = bounds.getCenterLonLat();
+ fixmystreet.map.setCenter(center, fixmystreet.map.getZoomForExtent(bounds), false, true);
+ }
});
}