[OpenLayers-Users] DrawFeature and FeatureAdded event

Eric Lemoine eric.c2c at gmail.com
Tue Nov 25 01:27:10 EST 2008


Hi. So I guess when the user just does clicks (without mousemove
between down and up) the feature isn't added to the layer either, is
that correct?

Anyway it sounds to me that you've found a bug. Could you open a
ticket for this, with an example or a link to reproduce the problem?

Eric

2008/11/24, Sture Dingsøyr <candalt at online.no>:
> Hi all
>
> Have made a control in OL that allows the user to draw a regular polygon.
> Have also added an event that uses the "featureadded" event.
>
> But...when the user only click in the map..a small polygon is drawed, but
> the event trigger is not fired..
>
> If the user draws a "larger" polygon the trigger fires just fine...
>
> Any suggestions?
>
> My ol code is this:
>
> var myVector = new OpenLayers.Layer.Vector("My vector");
> map.addLayer(myVector);
>
> var findRectangle = new OpenLayers.Control.DrawFeature(
> 	myVector,
> 	OpenLayers.Handler.RegularPolygon,
> 	{
> 		id: 'defaultControl01',
> 		title: "Klikk eller dra ut firkant rundt objekt i kartet for å finne mer
> informasjon",
> 		handlerOptions: {sides: 4, irregular: true},
> 		displayClass: 'findRectangle'            		
> 	}
> );
>
> findRectangle.events.register('featureadded', findRectangle,
> findRectangleFeaturAadded);
>
> function findRectangleFeaturAadded(feature) {
> alert(feature);
> }
>


More information about the Users mailing list