[OpenLayers-Users] allow drag through div

Paul Stanton paul at mapshed.com.au
Mon Apr 11 02:29:13 EDT 2011


Hi Andreas,

Yes, I saw that option but we are stuck on openlayers 2.7 for now which 
does not have that feature.

I know this behaviour is still possible since other openlayers controls 
can do it.

p.

On 11/04/2011 4:09 PM, Andreas Hocevar wrote:
> Hi,
>
> set the documentDrag option of the Navigation control to true: http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Control/Navigation-js.html#OpenLayers.Control.Navigation.documentDrag
>
> Look at the example http://openlayers.org/dev/examples/document-drag.html to see how this is done.
>
> Andreas.
>
> var map = new OpenLayers.Map("my-map", {});
> On Apr 11, 2011, at 00:13 , Paul Stanton wrote:
>
>> 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>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>


More information about the Users mailing list