ThinkGeo.com    |     Documentation    |     Premium Support

Is There a Way to Turn off Mouse Scroll Wheel Zooming?

Hi,


Some of my users really like using the mouse scroll wheel to zoom in and out while other do not. Is there anyway to turn off the Scroll Wheel Mouse zooming functionality on the map control?


Thanks!


 



Clint,

You can implement this by adding some codes as following, here also attached the whole sample code:

Server Code:
    Map1.MapTools.MouseMapTool.Enabled = false;

Client Code added in the header tag:
 
   <script type=“text/javascript”>
        var OnMapCreated = function(){
            var map = Map1.GetOpenLayersMap();
            var navigation = new OpenLayers.Control.Navigation({zoomWheelEnabled:false});
                  navigation.wheelUp = function(){return false;};
                  navigation.wheelDown = function(){return false;};
            map.addControl(navigation);
        }
    </script>

Ben.

136-Post4790ForClint.zip (112 KB)

Thanks for the example!  But I have a follow up questions. 
  
 Is there anyway to disable the scroll wheel zooming while leaving the property below set to true? 
  
 Map1.MapTools.MouseMapTool.Enabled = true; 
  
 Are there any plans to allow control over these functions via server side code? 
  
 Thanks!

Clint, 
  
 We cannot do it with the current version (3.0.117). We are now still working on this, thinking about how to make it easier for users to custom their mouse controls and how to make it more extensible. Do you have some good ideas? Any suggestion will be appreciated. 
  
 Allowing the control via server side code is also open to us, but I will not be sure until the final decision. 
  
 Ben.