diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-08-19 12:51:29 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-08-19 12:51:29 +0100 |
commit | 5ec9b282a03a31d850d038f0384f2695613b74bb (patch) | |
tree | a8bf778df032d9dbce5e0b57fa3fd839ca96e597 /web/js/map-OpenLayers.js | |
parent | 525ca068756d74fafa33cf0626ef10ac50140057 (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.
Diffstat (limited to 'web/js/map-OpenLayers.js')
-rw-r--r-- | web/js/map-OpenLayers.js | 42 |
1 files changed, 8 insertions, 34 deletions
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; } |