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:
@@ -229,13 +229,19 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
||||
*/
|
||||
destroy: function() {
|
||||
if (this.strategies) {
|
||||
for(var i=0, len=this.strategies.length; i<len; i++) {
|
||||
this.strategies[i].destroy();
|
||||
var strategy, i, len;
|
||||
for(i=0, len=this.strategies.length; i<len; i++) {
|
||||
strategy = this.strategies[i];
|
||||
if(strategy.autoDestroy) {
|
||||
strategy.destroy();
|
||||
}
|
||||
}
|
||||
this.strategies = null;
|
||||
}
|
||||
if (this.protocol) {
|
||||
this.protocol.destroy();
|
||||
if(this.protocol.autoDestroy) {
|
||||
this.protocol.destroy();
|
||||
}
|
||||
this.protocol = null;
|
||||
}
|
||||
this.destroyFeatures();
|
||||
@@ -296,8 +302,31 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
|
||||
this.renderer.setSize(this.map.getSize());
|
||||
}
|
||||
if(this.strategies) {
|
||||
for(var i=0, len=this.strategies.length; i<len; i++) {
|
||||
this.strategies[i].activate();
|
||||
var strategy, i, len;
|
||||
for(i=0, len=this.strategies.length; i<len; i++) {
|
||||
strategy = this.strategies[i];
|
||||
if(strategy.autoActivate) {
|
||||
strategy.activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: removeMap
|
||||
* The layer has been removed from the map.
|
||||
*
|
||||
* Parameters:
|
||||
* map - {<OpenLayers.Map>}
|
||||
*/
|
||||
removeMap: function(map) {
|
||||
if(this.strategies) {
|
||||
var strategy, i, len;
|
||||
for(i=0, len=this.strategies.length; i<len; i++) {
|
||||
strategy = this.strategies[i];
|
||||
if(strategy.autoActivate) {
|
||||
strategy.deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user