Layer.Vector.removeMap must deactivate the strategies, r=fredj (closes #1649)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7708 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -21,6 +21,28 @@ OpenLayers.Strategy = OpenLayers.Class({
|
||||
*/
|
||||
options: null,
|
||||
|
||||
/**
|
||||
* Property: active
|
||||
* {Boolean} The control is active.
|
||||
*/
|
||||
active: null,
|
||||
|
||||
/**
|
||||
* Property: autoActivate
|
||||
* {Boolean} The creator of the strategy can set autoActivate to false
|
||||
* to fully control when the protocol is activated and deactivated.
|
||||
* Defaults to true.
|
||||
*/
|
||||
autoActivate: true,
|
||||
|
||||
/**
|
||||
* Property: autoDestroy
|
||||
* {Boolean} The creator of the strategy can set autoDestroy to false
|
||||
* to fully control when the strategy is destroyed. Defaults to
|
||||
* true.
|
||||
*/
|
||||
autoDestroy: true,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Strategy
|
||||
* Abstract class for vector strategies. Create instances of a subclass.
|
||||
@@ -32,6 +54,8 @@ OpenLayers.Strategy = OpenLayers.Class({
|
||||
initialize: function(options) {
|
||||
OpenLayers.Util.extend(this, options);
|
||||
this.options = options;
|
||||
// set the active property here, so that user cannot override it
|
||||
this.active = false;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -57,16 +81,34 @@ OpenLayers.Strategy = OpenLayers.Class({
|
||||
/**
|
||||
* Method: activate
|
||||
* Activate the strategy. Register any listeners, do appropriate setup.
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean} True if the strategy was successfully activated or false if
|
||||
* the strategy was already active.
|
||||
*/
|
||||
activate: function() {
|
||||
if (!this.active) {
|
||||
this.active = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: deactivate
|
||||
* Deactivate the strategy. Unregister any listeners, do appropriate
|
||||
* tear-down.
|
||||
*
|
||||
* Returns:
|
||||
* {Boolean} True if the strategy was successfully deactivated or false if
|
||||
* the strategy was already inactive.
|
||||
*/
|
||||
deactivate: function() {
|
||||
if (this.active) {
|
||||
this.active = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Strategy"
|
||||
|
||||
Reference in New Issue
Block a user