aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-21 19:18:47 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-21 19:18:47 +0000
commit47284eb828b836af4cdd1bb4f60af0e797cd6bd7 (patch)
tree2743a0ce121d125988c430c97be51709f9e61f8d /web
parent020b5112c58f30f5f83aac6f0aa53f91c90f8599 (diff)
Only need zoom altering if being used for OSM permalink; adjust for other uses.
Diffstat (limited to 'web')
-rw-r--r--web/js/map-OpenLayers.js16
-rw-r--r--web/js/map-OpenStreetMap.js4
-rw-r--r--web/js/map-bing-ol.js2
3 files changed, 17 insertions, 5 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index e28a4d982..62e94ed29 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -411,7 +411,7 @@ OpenLayers.Control.PanZoomFMS = OpenLayers.Class(OpenLayers.Control.PanZoom, {
/* Overriding Permalink so that it can pass the correct zoom to OSM */
OpenLayers.Control.PermalinkFMS = OpenLayers.Class(OpenLayers.Control.Permalink, {
- updateLink: function() {
+ _updateLink: function(alter_zoom) {
var separator = this.anchor ? '#' : '?';
var href = this.base;
if (href.indexOf(separator) != -1) {
@@ -430,7 +430,11 @@ OpenLayers.Control.PermalinkFMS = OpenLayers.Class(OpenLayers.Control.Permalink,
center = this.map.getLonLatFromViewPortPx(p);
}
- href += separator + OpenLayers.Util.getParameterString(this.createParams(center, this.map.getZoom()+fixmystreet.zoomOffset));
+ var zoom = this.map.getZoom();
+ if ( alter_zoom ) {
+ zoom += fixmystreet.zoomOffset;
+ }
+ href += separator + OpenLayers.Util.getParameterString(this.createParams(center, zoom));
// Could use mlat/mlon here as well if we are on a page with a marker
if (this.anchor && !this.element) {
window.location.href = href;
@@ -438,6 +442,14 @@ OpenLayers.Control.PermalinkFMS = OpenLayers.Class(OpenLayers.Control.Permalink,
else {
this.element.href = href;
}
+ },
+ updateLink: function() {
+ this._updateLink(0);
+ }
+});
+OpenLayers.Control.PermalinkFMSz = OpenLayers.Class(OpenLayers.Control.PermalinkFMS, {
+ updateLink: function() {
+ this._updateLink(1);
}
});
diff --git a/web/js/map-OpenStreetMap.js b/web/js/map-OpenStreetMap.js
index 54bf95964..9b8916946 100644
--- a/web/js/map-OpenStreetMap.js
+++ b/web/js/map-OpenStreetMap.js
@@ -7,8 +7,8 @@ function set_map_config(perm) {
new OpenLayers.Control.ArgParser(),
//new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.Permalink(permalink_id),
- new OpenLayers.Control.PermalinkFMS('osm_link', 'http://www.openstreetmap.org/'),
+ new OpenLayers.Control.PermalinkFMS(permalink_id),
+ new OpenLayers.Control.PermalinkFMSz('osm_link', 'http://www.openstreetmap.org/'),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
];
}
diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js
index 0525e53d3..34ea255e8 100644
--- a/web/js/map-bing-ol.js
+++ b/web/js/map-bing-ol.js
@@ -16,7 +16,7 @@ function set_map_config(perm) {
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.ArgParser(),
fixmystreet.nav_control,
- new OpenLayers.Control.Permalink(permalink_id),
+ new OpenLayers.Control.PermalinkFMS(permalink_id),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
];
/* Linking back to around from report page, keeping track of map moves */