when select feature control is destroyed and layers parameter was an array, the root container is not moved correctly, p=jorix, r=ahocevar,me (closes #2502)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10115 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -233,6 +233,9 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* Method: destroy
|
||||
*/
|
||||
destroy: function() {
|
||||
if(this.active && this.layers) {
|
||||
this.map.removeLayer(this.layer);
|
||||
}
|
||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||
if(this.layers) {
|
||||
this.layer.destroy();
|
||||
|
||||
@@ -397,6 +397,19 @@
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_destroy(t) {
|
||||
t.plan(1);
|
||||
var map = new OpenLayers.Map("map");
|
||||
var layer1 = new OpenLayers.Layer.Vector();
|
||||
map.addLayer(layer1);
|
||||
var control = new OpenLayers.Control.SelectFeature([layer1]);
|
||||
map.addControl(control);
|
||||
control.activate();
|
||||
control.destroy();
|
||||
t.eq(layer1.renderer.getRenderLayerId(), layer1.id,
|
||||
"Root container moved correctly when control is destroyed and layers was an array parameter");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user