[OpenLayers-Users] overwriting functions

Christopher Schmidt crschmidt at metacarta.com
Mon Sep 17 11:43:31 EDT 2007


On Mon, Sep 17, 2007 at 03:59:17PM +0200, Kevin Kempfer wrote:
> Hi,
> 
> Christopher Schmidt schrieb:
> >and overriding downFeature can be done similarly:
> >
> >mySelect = new OpenLayers.Control.SelectFeature(vectors, {onSelect: 
> >  serialize, onUnselect: deselect,multiple: true, downFeature:function()
> >  {alert('hi')}});
> >
> >However, before you do htis, I'd like to understand why, so we can
> >figure out in what way the OpenLayers SelectFeature handler is lacking. 
> 
> Thanks! I'd like to have the possibility to select features while
> hovering over them and to keep them selected on mouse out, when the user
> clicks on it. This is a change of the logic, so I thought overriding
> should be my solution. But you're right, because these are not API
> functions I'll have trouble sooner or later.

If you're aware of it being not an API method, it's okay to override it
-- I just wanted to make it clear that we can't ensure that your
application won't break if you upgrade in that case. In this case, what
would happen is that when you upgrade to 2.5, your behavior would just
revert.

I think you can see now how to override the function, so you can go
ahead with it if need be. Let me know if you have further problems.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list