allow toggling TYPE_TOOL controls in panels, p=jorix, r=me (closes #3294)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11965 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -46,6 +46,14 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
saveState: false,
|
||||
|
||||
/**
|
||||
* APIProperty: allowDepress
|
||||
* {Boolean} If is true the <OpenLayers.Control.TYPE_TOOL> controls can
|
||||
* be deactivated by clicking the icon that represents them. Default
|
||||
* is false.
|
||||
*/
|
||||
allowDepress: false,
|
||||
|
||||
/**
|
||||
* Property: activeState
|
||||
* {Object} stores the active state of this panel's controls.
|
||||
@@ -199,15 +207,19 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
|
||||
}
|
||||
return;
|
||||
}
|
||||
var c;
|
||||
for (var i=0, len=this.controls.length; i<len; i++) {
|
||||
c = this.controls[i];
|
||||
if (c != control &&
|
||||
(c.type === OpenLayers.Control.TYPE_TOOL || c.type == null)) {
|
||||
c.deactivate();
|
||||
if (this.allowDepress && control.active) {
|
||||
control.deactivate();
|
||||
} else {
|
||||
var c;
|
||||
for (var i=0, len=this.controls.length; i<len; i++) {
|
||||
c = this.controls[i];
|
||||
if (c != control &&
|
||||
(c.type === OpenLayers.Control.TYPE_TOOL || c.type == null)) {
|
||||
c.deactivate();
|
||||
}
|
||||
}
|
||||
control.activate();
|
||||
}
|
||||
control.activate();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user