aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenLayers.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-03-01 04:15:30 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-03-01 04:15:30 +0000
commit9a51dfaeef496a4d08b5054bf0e664184157cc29 (patch)
tree8f552c9dc1afc346095b28cbcb6a12cfc27460da /web/js/map-OpenLayers.js
parent0ebd9c37bd8c637342c0236af1404cfd07c37a11 (diff)
Animate moving of map when pin clicked somewhere inconvenient.
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r--web/js/map-OpenLayers.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 137103f7c..38a2930d3 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -490,10 +490,13 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
new OpenLayers.Projection("EPSG:4326"),
fixmystreet.map.getProjectionObject()
);
- fixmystreet.map.setCenter(lonlat, fixmystreet.map.getZoom(), true, true);
+ var p = fixmystreet.map.getViewPortPxFromLonLat(lonlat)
+ p.x -= $(window).width() / 3;
+ lonlat = fixmystreet.map.getLonLatFromViewPortPx(p);
+ fixmystreet.map.panTo(lonlat);
} else if (e.xy.x >= o.left && e.xy.x <= o.left + w + 24 && e.xy.y >= o.top && e.xy.y <= o.top + h + 64) {
// underneath where the new sidebar will appear
- fixmystreet.map.pan(-w, 0, { animate: false });
+ fixmystreet.map.pan(-w, 0, { animate: true });
}
}