[OpenLayers-Dev] Ticket #1359: spelling mistake?

Erik Uzureau euzuro at gmail.com
Thu Oct 23 19:33:36 EDT 2008


So, unfortunately, the right click events are not delivered to us by the
browser... rather we sort of goof them through in the
OpenLayers.Control.Navigation

So... I am not a whiz on the whole Control / Handler relationship, but the
hacked way I was able to get it to work is this:


           var myNavControl = new OpenLayers.Control.Navigation({
               handleRightClicks: true
           });


           map = new OpenLayers.Map('map', { controls: [
               myNavControl,
               new OpenLayers.Control.PanZoomBar(),
               new OpenLayers.Control.NavToolbar(),
               new OpenLayers.Control.LayerSwitcher()
           ]});

           //note that this has to come *after* the map is initialized since
it is precisely when
           // the nav control is added to the map that its draw() is called,
which is when its
           // handler.click is created.
           ///
           myNavControl.handlers.click.callbacks.rightclick = function() {
alert('boo'); }


...now there *must* be a sexier way of doing that... and i'll leave it up to
the dev list and those more versed in using the handlers to perhaps help us
out here. In the meantime, though, that should work for you.

Thanks again for the great bug report :-)
Erik


On Thu, Oct 23, 2008 at 5:46 PM, Chris Rankin <rankincj at yahoo.com> wrote:

> --- On Thu, 23/10/08, Erik Uzureau <euzuro at gmail.com> wrote:
> > can you let us know if that fixes your problem?
>
> Thanks for doing that, Erik. It doesn't fix my problem with my custom
> right-click event not being run, although I am sure that the default
> mouseup() handler is running for a right-click event. Is my registered
> function supposed to be run via the call to
>
> this.callback('rightclick', [evt])
>
> in the rightclick() function in Click.js?
>
> Thanks,
> Chris
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20081023/644e263b/attachment.html


More information about the Dev mailing list