[OpenLayers-Dev] Right Mouse click for WMSGetFeatureInfo

Eric Lemoine eric.lemoine at camptocamp.com
Wed Mar 17 17:25:42 EDT 2010

2010/3/17 Cédric Moullet <cedric.moullet at camptocamp.com>:
> Hi,
> I'd like to have the OpenLayers.Control.WMSGetFeatureInfo working on the
> right mouse click instead of the left mouse click.
> I tried to modify it in the following way
> (http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js#L195)
> this.handler = new OpenLayers.Handler.Click(this,
>                 {rightclick: this.getInfoForClick},
> this.handlerOptions.click || {});
> But without success. Could you give me a hint in order to support right
> mouse click with this control ?

you also need double:true in the handler options. This can be set by
providing the following in the control options:

    handlerOptions: {
        click: {
            "double": true,
            "single": false

Then it should work.

But I think the control should do

this.handler = new OpenLayers.Handler.Click(this, {
    click: this.getInfoForClick,
    rightclick: this.getInfoForClick
}, this.handlerOptions.click || {});

so that providing appropriate handler options to the could would
suffice to make it work on rightclick.


Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com

More information about the Dev mailing list