aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/js/map-OpenLayers.js26
-rw-r--r--web/js/map-OpenStreetMap.js2
-rw-r--r--web/js/map-bing-ol.js2
-rw-r--r--web/js/map-google-ol.js2
-rw-r--r--web/js/map-streetview.js2
-rw-r--r--web/js/map-toner-lite.js2
-rw-r--r--web/js/map-wmts-bristol.js2
-rw-r--r--web/js/map-wmts-zurich.js2
8 files changed, 24 insertions, 16 deletions
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index e76ac439e..a18741049 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -831,15 +831,6 @@ $.extend(fixmystreet.utils, {
fixmystreet.map.addLayer(layer);
}
- if (!fixmystreet.map.getCenter()) {
- var centre = new OpenLayers.LonLat( fixmystreet.longitude, fixmystreet.latitude );
- centre.transform(
- new OpenLayers.Projection("EPSG:4326"),
- fixmystreet.map.getProjectionObject()
- );
- fixmystreet.map.setCenter(centre, fixmystreet.zoom || 3);
- }
-
// map.getCenter() returns a position in "map units", but sometimes you
// want the center in GPS-style latitude/longitude coordinates (WGS84)
// for example, to pass as GET params to fixmystreet.com/report/new.
@@ -921,6 +912,23 @@ OpenLayers.Control.PanZoomFMS = OpenLayers.Class(OpenLayers.Control.PanZoom, {
}
});
+OpenLayers.Control.ArgParserFMS = OpenLayers.Class(OpenLayers.Control.ArgParser, {
+ getParameters: function(url) {
+ var args = OpenLayers.Control.ArgParser.prototype.getParameters.apply(this, arguments);
+ // Get defaults from provided data if not in URL
+ if (!args.lat && !args.lon) {
+ args.lon = fixmystreet.longitude;
+ args.lat = fixmystreet.latitude;
+ }
+ if (args.lat && !args.zoom) {
+ args.zoom = fixmystreet.zoom || 3;
+ }
+ return args;
+ },
+
+ CLASS_NAME: "OpenLayers.Control.ArgParserFMS"
+});
+
/* Overriding Permalink so that it can pass the correct zoom to OSM */
OpenLayers.Control.PermalinkFMS = OpenLayers.Class(OpenLayers.Control.Permalink, {
_updateLink: function(alter_zoom) {
diff --git a/web/js/map-OpenStreetMap.js b/web/js/map-OpenStreetMap.js
index 4165f8ee4..52eb95493 100644
--- a/web/js/map-OpenStreetMap.js
+++ b/web/js/map-OpenStreetMap.js
@@ -4,7 +4,7 @@ fixmystreet.maps.config = function() {
permalink_id = 'map_permalink';
}
fixmystreet.controls = [
- new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Attribution(),
//new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(),
diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js
index 526ad2da9..6c9ab8a62 100644
--- a/web/js/map-bing-ol.js
+++ b/web/js/map-bing-ol.js
@@ -6,7 +6,7 @@ fixmystreet.maps.config = function() {
fixmystreet.controls = [
new OpenLayers.Control.Attribution(),
- new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PermalinkFMS(permalink_id),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
diff --git a/web/js/map-google-ol.js b/web/js/map-google-ol.js
index 99670d4f2..4b2d818c9 100644
--- a/web/js/map-google-ol.js
+++ b/web/js/map-google-ol.js
@@ -23,7 +23,7 @@ fixmystreet.maps.config = function() {
}
fixmystreet.controls = [
- new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PermalinkFMS(permalink_id),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
diff --git a/web/js/map-streetview.js b/web/js/map-streetview.js
index 6d9195246..4701a7f20 100644
--- a/web/js/map-streetview.js
+++ b/web/js/map-streetview.js
@@ -1,6 +1,6 @@
fixmystreet.maps.config = function() {
fixmystreet.controls = [
- new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.PanZoomFMS()
diff --git a/web/js/map-toner-lite.js b/web/js/map-toner-lite.js
index eda12ff28..0700dbb55 100644
--- a/web/js/map-toner-lite.js
+++ b/web/js/map-toner-lite.js
@@ -4,7 +4,7 @@ fixmystreet.maps.config = function() {
permalink_id = 'map_permalink';
}
fixmystreet.controls = [
- new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PermalinkFMS(permalink_id),
new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' })
diff --git a/web/js/map-wmts-bristol.js b/web/js/map-wmts-bristol.js
index 35f5ed0d6..88db20c52 100644
--- a/web/js/map-wmts-bristol.js
+++ b/web/js/map-wmts-bristol.js
@@ -104,7 +104,7 @@ fixmystreet.maps.config = function() {
}
fixmystreet.controls = [
- new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PermalinkFMS(permalink_id)
];
diff --git a/web/js/map-wmts-zurich.js b/web/js/map-wmts-zurich.js
index eda0fbf44..346e9b89a 100644
--- a/web/js/map-wmts-zurich.js
+++ b/web/js/map-wmts-zurich.js
@@ -135,7 +135,7 @@ fixmystreet.maps.config = function() {
// This stuff is copied from js/map-bing-ol.js
fixmystreet.controls = [
- new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.ArgParserFMS(),
new OpenLayers.Control.Navigation()
];
if ( fixmystreet.page != 'report' || !$('html').hasClass('mobile') ) {