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.
<html>
<head>
<script type="text/javascript"
src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
<body onload="loadmap();">
<script type="text/javascript">
function log(v)
{
document.getElementById('eventlog').innerHTML += v + '<br />';
}
function loadmap()
{
//basic setup
var map = new OpenLayers.Map('map');
var wms = new
OpenLayers.Layer.WMS("http://labs.metacarta.com/wms/vmap0",
{'layers':'basic'} );
map.addLayer(wms);
//Create handlers
var dblclick = new OpenLayers.Handler.Click(this, {dblclick:
function() { log('double'); }, click: function() {log('click');} },
{single: true, 'double': true, stopSingle: true, stopDouble: true});
var draghandler = new OpenLayers.Handler.Box(this, {done: function()
{this, log('draghandler');}} );
//Fix up the missing map reference
draghandler.setMap(map);
dblclick.setMap(map);
//Activate in correct order
draghandler.activate();
dblclick.activate();
}
</script>
<div style="width:400px; height:200px; border: 1px blue solid;"
id="map"></div>
<div id="eventlog"></div>
</body>
</html>
Regards, Kenneth Skovhede, GEOGRAF A/S
Eric Lemoine skrev:
On Mon, Jun 9, 2008 at 3:02 PM, Kenneth Skovhede, GEOGRAF A/S
<[EMAIL PROTECTED]> wrote:
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?
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
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users