[OpenLayers-Users] Handling double click

Eric Lemoine eric.c2c at gmail.com
Mon Jun 9 14:59:03 EDT 2008


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



More information about the Users mailing list