aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-08-19 12:51:29 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-08-19 12:51:29 +0100
commit5ec9b282a03a31d850d038f0384f2695613b74bb (patch)
treea8bf778df032d9dbce5e0b57fa3fd839ca96e597
parent525ca068756d74fafa33cf0626ef10ac50140057 (diff)
Make sure PanZoom works in older OpenLayers.
Remove unused code that is same as upstream (it was added when the map middle didn't match the visible middle), and the world button.
-rw-r--r--web/cobrands/sass/_base.scss5
-rw-r--r--web/js/map-OpenLayers.js42
2 files changed, 8 insertions, 39 deletions
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index d7b3263a3..67bc35164 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -1094,11 +1094,6 @@ html.js #map .noscript {
filter: none !important; // Override OpenLayers PNG handling of the navigation
}
-#fms_pan_zoom_zoomworld {
- display: none !important;
- visibility: none !important;
-}
-
#fms_pan_zoom_panup {
background-position: -42px -222px;
#{$right}: 30px;
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 2790f13d3..0300c0acc 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -536,39 +536,6 @@ var fixmystreet = fixmystreet || {};
zoomTo(0) rather than zoomToMaxExtent()
*/
OpenLayers.Control.PanZoomFMS = OpenLayers.Class(OpenLayers.Control.PanZoom, {
- onButtonClick: function (evt) {
- var btn = evt.buttonElement;
- switch (btn.action) {
- case "panup":
- this.map.pan(0, -this.getSlideFactor("h"));
- break;
- case "pandown":
- this.map.pan(0, this.getSlideFactor("h"));
- break;
- case "panleft":
- this.map.pan(-this.getSlideFactor("w"), 0);
- break;
- case "panright":
- this.map.pan(this.getSlideFactor("w"), 0);
- break;
- case "zoomin":
- case "zoomout":
- case "zoomworld":
- var size = this.map.getSize(),
- xy = { x: size.w / 2, y: size.h / 2 };
- switch (btn.action) {
- case "zoomin":
- this.map.zoomTo(this.map.getZoom() + 1, xy);
- break;
- case "zoomout":
- this.map.zoomTo(this.map.getZoom() - 1, xy);
- break;
- case "zoomworld":
- this.map.zoomTo(0, xy);
- break;
- }
- }
- },
_addButton: function(id1, id2) {
var btn = document.createElement('div'),
id = id1 + id2;
@@ -577,6 +544,14 @@ OpenLayers.Control.PanZoomFMS = OpenLayers.Class(OpenLayers.Control.PanZoom, {
btn.action = id;
btn.className = "olButton";
this.div.appendChild(btn);
+ if (OpenLayers.VERSION_NUMBER.indexOf('2.11') > -1) {
+ btn.map = this.map;
+ OpenLayers.Event.observe(btn, "mousedown", OpenLayers.Function.bindAsEventListener(this.buttonDown, btn));
+ var slideFactorPixels = this.slideFactor;
+ btn.getSlideFactor = function() {
+ return slideFactorPixels;
+ };
+ }
this.buttons.push(btn);
return btn;
},
@@ -592,7 +567,6 @@ OpenLayers.Control.PanZoomFMS = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this._addButton("pan", "right");
this._addButton("pan", "down");
this._addButton("zoom", "in");
- this._addButton("zoom", "world");
this._addButton("zoom", "out");
return this.div;
}