[OpenLayers-Users] PropertyStyles not working in IE7

Andreas Hocevar ahocevar at opengeo.org
Mon Jan 12 11:14:01 EST 2009


Hi,

2009/1/12  <Peter.Sykora at ooe.gv.at>:
> I try to create a vector map with selectable polygons. Therefore I would
> like to define a default style and a select style. I tried to adapt the
> code, which is documented in http://trac.openlayers.org/wiki/Styles under
> "Using PropertyStyles", to my needs:
>
>                                 var gemSymbolizer = new
> OpenLayers.Util.applyDefaults(
>                                         {
>                                                 strokeColor: "black",
>                                                 strokeWidth: 1,
>                                                 strokeOpacity: 0.6,
>                                                 fillOpacity: 0.8
>                                         }
>                                 );

Not sure if this is the reason, but the API for Util.applyDefaults is:
OpenLayers.Util.applyDefaults(target, source);

You will want to add a second argument to applyDefaults, e.g.
OpenLayers.Feature.Vector.style["default"]. See below.

>
>                                 var selSymbolizer = new
> OpenLayers.Util.applyDefaults(
>                                         {
>                                                         strokeColor:
> "yellow",
>                                                         strokeWidth: 3,
>                                                         strokeOpacity: 0.9
                                          },
OpenLayers.Feature.vector.style["default"];
>                                 );
>
>                                 var gemStyle = new OpenLayers.StyleMap(
>                                         {
>                                                 default: gemSymbolizer,
>                                                 select: selSymbolizer
>                                         }
>                                 );

Liebe Grüße nach Oberösterreich,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list