<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Yes. I have the problem even though I always activate the click handler
last.<br>
<br>
As always, the actual code is deep within a lot of unrelated code.<br>
<br>
I have constructed the following example to illustrate my point.<br>
I would expect that "doubleclick" and "click" would override the
draghandler, but it does not.<br>
<br>
<tt><html><br>
<head><br>
<script type="text/javascript"
src=<a class="moz-txt-link-rfc2396E" href="http://openlayers.org/api/OpenLayers.js">"http://openlayers.org/api/OpenLayers.js"</a>></script><br>
</head><br>
<body onload="loadmap();"><br>
<script type="text/javascript"><br>
<br>
function log(v)<br>
{<br>
document.getElementById('eventlog').innerHTML += v + '<br />';<br>
}<br>
<br>
function loadmap()<br>
{<br>
//basic setup<br>
var map = new OpenLayers.Map('map');<br>
var wms = new
OpenLayers.Layer.WMS(<a class="moz-txt-link-rfc2396E" href="http://labs.metacarta.com/wms/vmap0">"http://labs.metacarta.com/wms/vmap0"</a>,
{'layers':'basic'} );<br>
map.addLayer(wms);<br>
<br>
//Create handlers<br>
var dblclick = new OpenLayers.Handler.Click(this, {dblclick:
function() { log('double'); }, click: function() {log('click');} },
{single: true, 'double': true, stopSingle: true, stopDouble: true});<br>
var draghandler = new OpenLayers.Handler.Box(this, {done:
function() {this, log('draghandler');}} );<br>
<br>
//Fix up the missing map reference<br>
draghandler.setMap(map);<br>
dblclick.setMap(map);<br>
<br>
//Activate in correct order<br>
draghandler.activate();<br>
dblclick.activate();<br>
}<br>
</script><br>
<br>
<div style="width:400px; height:200px; border: 1px blue solid;"
id="map"></div><br>
<div id="eventlog"></div><br>
</body><br>
</html></tt><br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Eric Lemoine skrev:
<blockquote
cite="mid:5ec103de0806090949l4de8252ale24c46527a743279@mail.gmail.com"
type="cite">
<pre wrap="">On Mon, Jun 9, 2008 at 3:02 PM, Kenneth Skovhede, GEOGRAF A/S
<a class="moz-txt-link-rfc2396E" href="mailto:ks@geograf.dk"><ks@geograf.dk></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap=""><!---->
Do you still have the problem if you make sure the click handler is
activated after the drag handler?
Can you share your code so that we can reproduce?
--
Eric
</pre>
</blockquote>
</body>
</html>