[OpenLayers-Users] allow drag through div

Paul Stanton paul at mapshed.com.au
Sun Apr 10 18:13:44 EDT 2011


|Hi all,

Sorry if this is a re-post, I can't see my posts coming through the list yet....

I have an openlayers map and I have positioned a div to sit inside/over the map component.

This works fine, however when dragging the map, if the mouse moves through/over the div the drag action is terminated.

How can I avoid the drag action from terminating?

I know this is possible because many openlayers controls do the same however I can't track down the code to enable this feature.

thanks, p.

||<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
   <script type="text/javascript"  src="http://www.openlayers.org/api/OpenLayers.js"></script>
   <script type="text/javascript"  src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
</head>
<body>

<div id="map"  style="margin:0px; width:300px; height:200px;"></div>
<div id="overlay"  style="position:absolute; width:100px; height:75px; border:1px solid red; background-color:white; z-index:5000; text-align:center;">I want to drag through this</div>

<script type="text/javascript">
     //  create map
     var map=  new OpenLayers.Map("map",  {"maxResolution":0.703125});
     map.addLayers([new OpenLayers.Layer.WMS("World Map",  "http://labs.metacarta.com/wms-c/Basic.py?",  {layers:"basic",  format:"image/png"})]);
     map.zoomToMaxExtent();

     //  put div over map
     Position.clone($("map"),  $("overlay"),  {offsetLeft:100,  offsetTop:62.5,  setWidth:false,  setHeight:false});
</script>

</body>
</html>|

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110411/0c41b4a4/attachment.html


More information about the Users mailing list