changed the renderer's getRenderLayer method to getRenderLayerId, which
always works even if the layer is not added to a map. Also removed an unneeded map.events.unregister from Control.SelectFeature. r=elemoine (closes #2022) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9160 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -226,8 +226,6 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
if(this.handlers.box) {
|
||||
this.handlers.box.deactivate();
|
||||
}
|
||||
this.map.events.unregister("changelayer", this.layer,
|
||||
this.layer.handleChangeLayer);
|
||||
this.map.removeLayer(this.layer);
|
||||
}
|
||||
return OpenLayers.Control.prototype.deactivate.apply(
|
||||
|
||||
@@ -127,7 +127,7 @@ OpenLayers.Layer.Vector.RootContainer = OpenLayers.Class(OpenLayers.Layer.Vector
|
||||
var layer;
|
||||
for(var i=0; i<this.layers.length; ++i) {
|
||||
layer = this.layers[i];
|
||||
if(layer.renderer.getRenderLayer() == this) {
|
||||
if(this.renderer && layer.renderer.getRenderLayerId() == this.id) {
|
||||
this.renderer.moveRoot(layer.renderer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,18 +256,16 @@ OpenLayers.Renderer = OpenLayers.Class({
|
||||
moveRoot: function(renderer) {},
|
||||
|
||||
/**
|
||||
* Method: getRenderLayer
|
||||
* Method: getRenderLayerId
|
||||
* Gets the layer that this renderer's output appears on. If moveRoot was
|
||||
* used, this will be different from the layer containing the features
|
||||
* rendered by this renderer.
|
||||
* To be overridden by subclasses that implement moveRoot.
|
||||
* used, this will be different from the id of the layer containing the
|
||||
* features rendered by this renderer.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Layer.Vector>} the output layer, if any (i.e. this method
|
||||
* will not return a layer if the layer is not added to a map).
|
||||
* {String} the id of the output layer.
|
||||
*/
|
||||
getRenderLayer: function() {
|
||||
return this.map.getLayer(this.container.id);
|
||||
getRenderLayerId: function() {
|
||||
return this.container.id;
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Renderer"
|
||||
|
||||
@@ -898,17 +898,16 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: getRenderLayer
|
||||
* Method: getRenderLayerId
|
||||
* Gets the layer that this renderer's output appears on. If moveRoot was
|
||||
* used, this will be different from the layer containing the features
|
||||
* rendered by this renderer.
|
||||
* used, this will be different from the id of the layer containing the
|
||||
* features rendered by this renderer.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Layer.Vector>} the output layer, if any (i.e. this method
|
||||
* will not return a layer if it is not added to a map).
|
||||
* {String} the id of the output layer.
|
||||
*/
|
||||
getRenderLayer: function() {
|
||||
return this.map.getLayer(this.root.parentNode.parentNode.id);
|
||||
getRenderLayerId: function() {
|
||||
return this.root.parentNode.parentNode.id;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user