[OpenLayers-Dev] OpenLayer.Select.Feature and Root Container

geographika geographika at gmail.com
Thu May 19 11:36:15 EDT 2011

Hi All,

The OpenLayer.Select.Feature allows either a single layer or an array of 
layers to be passed into the constructor.
If an array of layers is passed to the control then all the layers are 
collected up and put into a OpenLayers.Layer.Vector.RootContainer.

This caused an error where I could no longer set opacity on a layer when 
it had been added to a select control e.g.

         var map = new OpenLayers.Map('map');
         var vectorLayer = new OpenLayers.Layer.Vector();

         var tool = new OpenLayers.Control.SelectFeature([vectorLayer], 
{map: map});
         vectorLayer.setOpacity(0.3); //works
         console.log(vectorLayer.div.childNodes[0].firstChild); //<g 
id="OpenLayers.Layer.Vector_37_root" style="opacity: 0.3;">
         //vectorLayer.setOpacity(0.5); //will no longer work as the 
"element is null" when trying to set the opacity
         console.log(vectorLayer.div.childNodes[0].firstChild); //null

Should the setOpacity function be overriden in the 
OpenLayers.Layer.Vector class to take this into account?
I can file this as a ticket if it is an issue rather than just my 

twitter: @geographika

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110519/f5022737/attachment.html

More information about the Dev mailing list