[OpenLayers-Users] Handling double click

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Mon Jun 9 09:02:38 EDT 2008


Hi Eric.

(I think my "DoubleClick" is an old version of the "Click" handler).

I have now figured out the problem.
I have a DragHandler registered.
That means the "mousedown" / "mouseup" events are triggered.
Since the "mouseup" is correctly handled, the "click" is never fired, 
and neither is "dblclick".

Do you have any suggestion on how to deal with this problem?

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