Skip to content
Advertisement

react-google-maps/api Remove need to hold ctrl to zoom

I’ve setup a map in my react app with react-google-maps/app, but there’s something that’s annoying me. To zoom the map with the scroll wheel, you have to hold down the control key. Is there a way I can disabled this so that I can zoom without holding control. Is there a way to do this?

Here’s the code I have for my map:

JavaScript

Advertisement

Answer

After looking at the docs for the google maps javascript API, I found that you can do this using the options prop of the GoogleMap component, and setting gestureHandling to greedy, like so:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement