javascriptgoogle-maps

Disable the Ctrl + Scroll to Zoom google maps


Does anybody know how to disable the CTRL + Scroll?

First when the mouse wheel was moved the Map would Zoom in/out. But now it asks to press CTRL + Mouse Wheel Scroll to Zoom in/out.

How do we disable this feature? I can't seem to find anything in the documentation:

https://developers.google.com/maps/documentation/javascript/controls#ControlOptions

enter image description here


Solution

  • You need to pass gestureHandling: 'greedy' to your map options.

    Documentation: https://developers.google.com/maps/documentation/javascript/interaction#gestureHandling

    For example:

    const map = new google.maps.Map(mapElement, {
      center: { 0, 0 },
      zoom: 4,
      gestureHandling: 'greedy'
    });
    

    Update! Since Google Maps 3.35.6 you need to encase the property into an options wrapper:

    const map = new google.maps.Map(mapElement, {
      center: { 0, 0 },
      zoom: 4,
      options: {
        gestureHandling: 'greedy'
      }
    });
    

    Thank you ealfonso for the new info