Adding an autoActivate property for controls. If this is set to true, the control will be activated when it is added to a map. This is true for the Navigation, NavigationHistory, KeyboardDefaults, and Panel controls. False for others. r=elemoine (closes #2200)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9589 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2009-07-24 21:58:39 +00:00
parent 1afb016408
commit 8b741bc666
7 changed files with 60 additions and 10 deletions

View File

@@ -21,6 +21,13 @@
*/
OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: autoActivate
* {Boolean} Activate the control when it is added to a map. Default is
* true.
*/
autoActivate: true,
/**
* APIProperty: slideFactor
* Pixels to slide by.
@@ -53,7 +60,6 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
draw: function() {
this.handler = new OpenLayers.Handler.Keyboard( this, {
"keydown": this.defaultKeyPress });
this.activate();
},
/**

View File

@@ -65,6 +65,13 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
*/
zoomBoxKeyMask: OpenLayers.Handler.MOD_SHIFT,
/**
* APIProperty: autoActivate
* {Boolean} Activate the control when it is added to a map. Default is
* true.
*/
autoActivate: true,
/**
* Constructor: OpenLayers.Control.Navigation
* Create a new navigation control
@@ -153,7 +160,6 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
this, {"up" : this.wheelUp,
"down": this.wheelDown} );
this.activate();
},
/**

View File

@@ -67,11 +67,11 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
limit: 50,
/**
* Property: activateOnDraw
* {Boolean} Activate the control when it is first added to the map.
* Default is true.
* APIProperty: autoActivate
* {Boolean} Activate the control when it is added to a map. Default is
* true.
*/
activateOnDraw: true,
autoActivate: true,
/**
* Property: clearOnDeactivate
@@ -224,9 +224,6 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Control.prototype.draw.apply(this, arguments);
this.next.draw();
this.previous.draw();
if(this.activateOnDraw) {
this.activate();
}
},
/**

View File

@@ -21,6 +21,13 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
*/
controls: null,
/**
* APIProperty: autoActivate
* {Boolean} Activate the control when it is added to a map. Default is
* true.
*/
autoActivate: true,
/**
* APIProperty: defaultControl
* {<OpenLayers.Control>} The control which is activated when the control is
@@ -107,7 +114,6 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
scope: this
});
}
this.activate();
return this.div;
},