adds a zoomBoxEnabled boolean option in Control.Navigation, r=ahocevar, (Closes #2416)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10067 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
pgiraud
2010-02-15 13:08:28 +00:00
parent 7a546bf5c5
commit b165d015e1
2 changed files with 49 additions and 1 deletions

View File

@@ -49,6 +49,12 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
*/
zoomBox: null,
/**
* APIProperty: zoomBoxEnabled
* {Boolean} Whether the user can draw a box to zoom
*/
zoomBoxEnabled: true,
/**
* APIProperty: zoomWheelEnabled
* {Boolean} Whether the mousewheel should zoom the map
@@ -129,7 +135,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
this.handlers.wheel.activate();
}
this.handlers.click.activate();
this.zoomBox.activate();
if (this.zoomBoxEnabled) {
this.zoomBox.activate();
}
return OpenLayers.Control.prototype.activate.apply(this,arguments);
},
@@ -252,6 +260,24 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
this.wheelChange(evt, delta || -1);
},
/**
* Method: disableZoomBox
*/
disableZoomBox : function() {
this.zoomBoxEnabled = false;
this.zoomBox.deactivate();
},
/**
* Method: enableZoomBox
*/
enableZoomBox : function() {
this.zoomBoxEnabled = true;
if (this.active) {
this.zoomBox.activate();
}
},
/**
* Method: disableZoomWheel
*/