[OpenLayers-Users] Change colors on a selected polygon (feature)

Andreas Hocevar andreas.hocevar at gmail.com
Tue Jan 22 05:33:20 EST 2008


Hi,

Swärd Mårten wrote:
>
> How do I do to change the fill-color of a selected feature (polygon) 
> from the default blue one? I just want a border around the selected 
> feature but with the original fill-color…
>

You have to set the selectStyle property of 
OpenLayers.Control.SelectFeature. Currently, the selectStyle is a 
separate style and does not extend the feature style. So your 
requirement can only be fulfilled if you have the same fill-color for 
all features of your layer.

See http://trac.openlayers.org/ticket/1260 for a patch if you want to 
have your feature style extended by the selectStyle.

Regards,
Andreas.



More information about the Users mailing list