[OpenLayers-Users] Which OpenLayers.Feature.Vector.style is
used while drawing?
Lance Dyas
lancelot at inetnebr.com
Fri Mar 30 19:49:37 EDT 2007
Speaking of this how would you capture the "done" event after the user
draws a feature?
And is decent measuring tool already in the works by somebody?
Tim Schaub wrote:
> Jeff Dege wrote:
>
>> I'm trying to draw polygons in a different color than the default. But
>> I've only managed to change the color of the drawn polygons.
>>
>>
>
> Currently, the handler that does the drawing (Point, Path, or Polygon)
> is in charge if the style of your sketches (features before they are
> completed).
>
> You can change the options for the handler by passing a handlerOptions
> object in your control constructor. So, something like this would work:
>
> var options = {
> handlerOptions: {
> freehand: true,
> style: {
> fillColor: "yellow",
> fillOpacity: 0.4,
> strokeColor: "green",
> strokeOpacity: 1,
> strokeWidth: 1,
> pointRadius: 6
> }
> }
> };
> var control = new OpenLayers.Control.DrawFeature(polygonLayer,
> OpenLayers.Handler.Polygon, options);
>
> Now your polygon sketches will have a green outline and a yellow fill.
>
> Note that this is subject to change before the release of 2.4.
>
> Tim
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
> .
>
>
More information about the Users
mailing list