Allow zooming only with scroll in google maps

2019-01-24 03:34发布

问题:

Since a few days our users can only zoom when they hit the "ctrl" key while scrolling which doesn't make sense in our applications.

Is there a way to allow zooming only with scrolling (as it was before) in Google Maps?

I've seen that this "ctrl + scroll" force now also is in the google maps api reference (screenshot).

Screenshot from the Google Maps Javascript API reference which shows the new message

回答1:

Add gestureHandling: 'greedy' to your map options during instantiation.

E.g:

var map = new google.maps.Map(document.getElementById('map'), {
    center: {0, 0},
    zoom: 8,
    gestureHandling: 'greedy'
  });
}