[OpenLayers-Users] Handling double click
Kenneth Skovhede, GEOGRAF A/S
ks at geograf.dk
Mon May 19 15:42:36 EDT 2008
I see. For some reason I have a handler called
OpenLayers.Handler.DoubleClick with a MetaCarta copyright notice.
I can see that the Click handler is much closer to what I want.
I will try it out.
Thank you.
Regards, Kenneth Skovhede, GEOGRAF A/S
Eric Lemoine skrev:
> Hi. I'm not sure i understand. Do you use OL click handler or have you
> implemented your own double click handler? OL click handler supports
> double click. So use that handler with appropriate options, in part
> use stopClick:true and make sure you activate the handler after the OL
> controls. Tell me how it goes. Eric
>
> 2008/5/19, Kenneth Skovhede, GEOGRAF A/S <ks at geograf.dk>:
>
>> I have a map where several features have links attached.
>> A script checks the current cursor position against the server to
>> determine if there is a link at the current location.
>> If there is, the cursor changes to the hand cursor.
>> This all works fine.
>>
>> Regardless of what tool the user has, I would like to intercept a
>> double-click.
>> I can do that with the doubleclick handler:
>> doubleClick = new OpenLayers.Handler.DoubleClick(this, {dblclick:
>> this.OnDoubleClick}, {single: false, 'double': true, stopSingle: false,
>> stopDouble: true});
>> doubleClick.activate();
>>
>> And it works, but the original tool also gets activated.
>> Ea., if the zoom tool is activated, it zooms twice for a double click,
>> as well as activating the custom doubleclick handler.
>>
>> Is there any way to achieve this?
>>
>> It seems that the "click" event is fired before the "doubleclick" event
>> happens, so it is difficult to filter the click.
>> My handler looks like this:
>>
>> OnDoubleClick: function(evt)
>> {
>> if (this.activeLink != null)
>> {
>> window.open(this.activeLink, this.target);
>> OpenLayers.Event.stop(evt);
>> return false;
>> }
>> else
>> return true;
>> },
>>
>> The "return false" does not prevent the click events from occuring.
>> Stopping the single click events makes the current tool useless.
>>
>> --
>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
More information about the Users
mailing list