ThinkGeo.com    |     Documentation    |     Premium Support

Pan

This might be a silly question, how can I disable Paning on the client-side. Currently, I am using the below code to restrict the extent. However, this require me to know bound extent. I need the extent to be dynamic.


On Client-side Load:


Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(restrictArea);


..


 function restrictArea() {map.setOptions({ "restrictedExtent": new OpenLayers.Bounds(CurrentMapBound.left, CurrentMapBound.top, CurrentMapBound.right, CurrentMapBound.bottom) }); }


 


 



Mark,


OpenLayers has an API to disable the panning. Here is the code.

  var OnMapCreated = function(map) {
            var navigation = map.getControlsByClass("OpenLayers.Control.Navigation")[0];
            navigation.dragPan.deactivate();
        }

Thanks,


Ben

341-DisablePanningOnClient.txt (276 Bytes)

This seems to disable only panning. Is there a way to disable the "Zoom to Area" (Shift and drag boundingbox) as welll. Thanks 


The following script will disable all the mouse functions, including the track zoom in. 
  
 
    var OnMapCreated = function(map) {
            var navigation = map.getControlsByClass("OpenLayers.Control.Navigation")[0];
            navigation.deactivate();
        }
 
  
 Thanks, 
  
 Ben