[OpenLayers-Users] possible "click" events conflict?

Eric Lemoine eric.c2c at gmail.com
Tue Nov 25 13:02:05 EST 2008


Hi. Are we sure the unregister("click") is the one to blame? It sounds
very unlikely to me. Eric

2008/11/24, Martin Ouellet <geomartino at gmail.com>:
> Hi all,
>
> I'am just working on my first app with OpenLayers in a editing context (wow
> it's fun) .
>
> Here's my problem:
> 1) I have a WMS layer of point, The user push a button to start editing (ex:
> move a point).  That button register the "click" event and then he click on
> the map to identify a point in the WMS layer.  In the background, I launch a
> GetFeatureInfo with the X,Y;
>
> map.events.register('click', map, onMapClick);
>
> 2) if the GetFeatureInfo find out a element at this location, I activate two
> editing tools (DrawFeature et ModifyFeature) and I draw a vector point.  The
> user can then click anyone else on the map (I only keep the last point he
> click) or move the point.
>
> controls = {
>   modify: new OpenLayers.Control.ModifyFeature(vector),
>     point: new OpenLayers.Control.DrawFeature(vector,
> OpenLayers.Handler.Point)
> }
>
> function activetool() {
>   for(key in controls) {
>     control.activate();
>   }
> }
>
> 3)  When the user as finish, the ACCEPT button update the database with the
> new position of the vector point and I unregister the click event.  I also
> deactivate the two editing tools (DrawFeature et ModifyFeature).
>
> map.events.unregister('click', this, onMapClick);
>
> function deactivate() {
>   for(key in controls) {
>     control.deactivate();
>   }
> }
>
> Everything works great but after that, I can no longer reactivate the
> editing tool.  Is it possible that when I unregister the click event for the
> GetFeatureInfo, the 'click' event required for the drawfeature tool is also
> deactivate?
>
> thank you in advance!
>
> MartinO
>



More information about the Users mailing list