Hi, http://openlayers.org/dev/examples/stylemap.html
On Mon, Feb 16, 2009 at 6:53 PM, Serge Travin <[email protected]> wrote: > Hi, > I'm using SelectFeature control and I want to set custom styles for > features, when they are in default and selected state. > Well, I've created feature and set it's style like this: > var defaultStyle = OpenLayers.Util.extend({}, > OpenLayers.Feature.Vector.style['default'] > ); > defaultStyle.strokeColor = mapBounds.color; > defaultStyle.fillOpacity = 0.0; > feature.style = defaultStyle; > and also I set selectStyle for SelectFeature control: > var selectStyle = OpenLayers.Util.extend({}, > OpenLayers.Feature.Vector.style['default'] > ); > selectStyle.strokeColor = mapBounds.color; > selectStyle.strokeWidth = 2; > selectStyle.fillOpacity = 0.2; > sf.selectStyle = selectStyle; > Everything is ok, except this case: > Feature is selected, it's drawn with select style, then I perform > zoom-in(out). and feature's style changes to default. > It's still selected, just drawn with default style. > I can avoid this by modifying feature style each time it's > selected/unselected, but I don't think it's a good idea. > Could anyone suggest smth? > Thanks in advance. > --- > wbr, Serge Travin. > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > > -- Ivan Grcic _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
