[OpenLayers-Users] Handling double click

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Tue Jun 10 06:44:52 EDT 2008


Yes, that seems to be the problem.
The mousedown/mouseup should not be handled if the event is a click or 
double click.
But the code cannot determine if it is a click or double click when the 
mouseup/down occurs.
Delaying the event will likely cause a very bad user experience.

Well, the conclusion is: It cannot be done.
Thank you for looking at it.

Regards, Kenneth Skovhede, GEOGRAF A/S


Eric Lemoine skrev:
> On Mon, Jun 9, 2008 at 8:20 PM, Kenneth Skovhede, GEOGRAF A/S
> <ks at geograf.dk> wrote:
>   
>> Yes. I have the problem even though I always activate the click handler
>> last.
>>
>> As always, the actual code is deep within a lot of unrelated code.
>>
>> I have constructed the following example to illustrate my point.
>> I would expect that "doubleclick" and "click" would override the
>> draghandler, but it does not.
>>     
>
> Thanks for the example, this helped me understand why you want. And I
> think that what you want cannot be achieved. The click handler doesn't
> care about the mousedown event so it lets it propagate. If the click
> handler prevented the mousedown event from propaging that wouldn't
> help you either, because (once the click handler activated) the box
> handler will *never* see mousedown events. Try the following to
> understand the latter:
>
> // append these lines after creating the click handler
> var clickhandler_mousedown = dblclick.mousedown;
> clickhandler.mousedown = function(evt) {
>     clickhandler_mousedown.call(clickhandler, evt);
>     return false; // prevent propagation
> };
>
> --
> Eric
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080610/cca6c763/attachment.html


More information about the Users mailing list