aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/map-OpenStreetMap.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-23 13:00:12 +0000
committerMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-23 13:00:12 +0000
commit8811ccf13f29f411979b50e098f59e86066b8258 (patch)
tree552fd5e65524d77d32f73483abd1bec5090f48aa /web/js/map-OpenStreetMap.js
parentebb927e969e693189c18d5520f526049676f6e5e (diff)
Override PanZoom to catch zoomworld click.
Diffstat (limited to 'web/js/map-OpenStreetMap.js')
-rw-r--r--web/js/map-OpenStreetMap.js39
1 files changed, 38 insertions, 1 deletions
diff --git a/web/js/map-OpenStreetMap.js b/web/js/map-OpenStreetMap.js
index c5aa318b0..6e350537a 100644
--- a/web/js/map-OpenStreetMap.js
+++ b/web/js/map-OpenStreetMap.js
@@ -4,7 +4,7 @@ YAHOO.util.Event.onContentReady('map', function() {
new OpenLayers.Control.ArgParser(),
//new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PanZoom()
+ new OpenLayers.Control.PanZoomFMS()
],
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
@@ -50,6 +50,43 @@ YAHOO.util.Event.onContentReady('map', function() {
});
+/* Overridding the buttonDown function of PanZoom so that it does
+ zoomTo(0) rather than zoomToMaxExtent()
+*/
+OpenLayers.Control.PanZoomFMS = OpenLayers.Class(OpenLayers.Control.PanZoom, {
+ buttonDown: function (evt) {
+ if (!OpenLayers.Event.isLeftClick(evt)) {
+ return;
+ }
+
+ switch (this.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":
+ this.map.zoomIn();
+ break;
+ case "zoomout":
+ this.map.zoomOut();
+ break;
+ case "zoomworld":
+ this.map.zoomTo(0);
+ break;
+ }
+
+ OpenLayers.Event.stop(evt);
+ }
+});
+
OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
defaultHandlerOptions: {
'single': true,