[mapserver-users] map mouseclick snafu

Paul Spencer pspencer at dmsolutions.ca
Mon Feb 18 15:00:35 EST 2008


In the code that handles the mouse click on the menu, you need to stop  
the event from propagating [1].  If you are using a javascript  
framework such as prototype [2], it will probably have such a  
mechanism (in prototype, for instance, you call Event.stop(evt)).  If  
you are not using a framework, you will need to add the code for  
stopping the event, this is what prototype uses:

if (evt.preventDefault) {
   evt.preventDefault();
   evt.stopPropagation();
} else {
   evt.returnValue = false;
   evt.cancelBubble = true;
}

The quirksmode site has some good information general information  
about javascript events [3].

Cheers

Paul

[1] http://www.quirksmode.org/js/events_order.html
[2] http://www.prototypejs.org/
[3] http://www.quirksmode.org/js/introevents.html


On 18-Feb-08, at 2:31 PM, Ben Thompson wrote:

> we have some dropdown menus above the map area. each item consisting  
> of an <a href=xxx>
> problem is, the menus overlay the map when unrolled and for some  
> reason the map gets the mouseclick too, causing it to repeat  
> applying whatever tool was last used (zoom in, etc). How to tell the  
> map not to do this (i.e., disable active tool), or, better, how to  
> make it not get clicked in the first place?
>
> thanx,
> Ben Thompson
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/



More information about the mapserver-users mailing list