[OpenLayers-Dev] Custom control handlers

Alexandre Dube adube at mapgears.com
Mon Dec 22 11:46:02 EST 2008

Alexandre Dube wrote:
> Hi devs,
>   Controls have a "handler" property, but no "handlers".  By default, in 
> Controls.js, on activation, it checks this.handler and activate it.
>   Which of these solutions is the best when you have multiple handlers 
> for a new custom control :
>   - register an on.("activate", function(){}) to activate its handlers
>   - create a new activate function for the customized control that 
> handles the handlers property
>   - modify Controls.js, add a handlers property and modify the activate 
> function to also check if handlers exist and activate all its handlers.
>   The same goes for deactivation.
>   Any tips ?
Thinking about it (please correct me if I'm wrong), the obvious answer 
is the 2nd option : create a new activate function.

But, the 3rd option could also be good as a minor modification to OL 
itself.  What do you think ?

Alexandre Dubé

More information about the Dev mailing list