[OpenLayers-Dev] Start drawing polygon on map with single click, ignore drag & dblclick

Andy Deakin andy.deakin at pcmend.net
Thu Jun 11 13:34:23 EDT 2009


Hi,

I would like a click to start drawing a polygon if it is not a drag and 
not a double click.

At the moment I am doing similar to the link that you provided, and the 
user has to click on 'Start Drawing' once they have navigated to where 
they want to start drawing. However, a single click (on its own) does 
not mean anything in navigate mode, so I think that it makes sense to 
use this single click to start drawing.

I have added a 'click' to the map with e.g.
map.events.register( 'click', this, startDraw );
but this is causing strange behavior.

Andy

Evan James Bowling wrote:
> Andy,
>
>   The controls do exist, but they have to be activated separately 
> right now.Here
> is a link that shows off the features you're looking for:
>
>       http://openlayers.org/dev/examples/drag-feature.html
>
>   Are you trying to make it so that a single click would either start 
> drawing a polygon or
> move the map depending on whether or not the cursor moved before release?
>
> -Evan
>
>
> On Wed, Jun 10, 2009 at 6:38 PM, Andy Deakin <andy.deakin at pcmend.net 
> <mailto:andy.deakin at pcmend.net>> wrote:
>
>     Hi list
>
>     I'm drawing a polygon on a map, but want drag events to move the map,
>     double click to zoom in, and a single click to start drawing the
>     polygon.
>
>     I have tried a number of methods, but the click propagation and
>     single/double click events make it difficult.
>
>     Is there a handler that does anything like this, or are there any
>     suggestions on how it can be done?
>
>     Cheers, Andy
>     _______________________________________________
>     Dev mailing list
>     Dev at openlayers.org <mailto:Dev at openlayers.org>
>     http://openlayers.org/mailman/listinfo/dev
>
>




More information about the Dev mailing list