Reputation: 598
I have multiple polylines drawn in a map, I would like them to change their color of depending on some event... Is there a function to change the strokecolor property once the polyline object has been added to the map?
Upvotes: 2
Views: 1053
Reputation: 117314
Use the setStyle
-method:
polyline.setStyle( polyline.getStyle().getCopy({strokeColor:'Red'}));
The getCopy
-method returns a copy of the given SpatialStyle where the properties of the argument({strokeColor:'Red'}
) replace the properties of the given SpatialStyle
Upvotes: 5