Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Enable ctr + scrollwheel to zoom in Google Maps Api

Hi im using Google Maps API https://angular-maps.com/, and i want to zoom only while pressing ctrl + scrolling with the scrollwheel. Reading the documentation I have found this:

gestureHandling This setting controls how gestures on the map are handled. Allowed values:

'cooperative' (Two-finger touch gestures pan and zoom the map. One-finger touch gestures are not handled by the map.) 'greedy' (All touch gestures pan or zoom the map.) 'none' (The map cannot be panned or zoomed by user gestures.) 'auto' [default] (Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or not. Type: |||

Default value: auto

so in my code i added :

<agm-map
    [latitude]="lat" 
    [longitude]="lng"
    [zoom]="zoom"
    [gestureHandling]="cooperative"
    [mapTypeControl]="true"
    [mapTypeControlOptions]="mapType"
    >

but is not working, it does not ask me to press ctrl to zoom.

like image 318
Fried Maxi Avatar asked Oct 25 '17 14:10

Fried Maxi


People also ask

How do I custom zoom on Google Maps?

You can change the zoom level of the map using simple steps. Step 1 Go to Add or Edit Map page . Step 2 Select 'Default zoom level' in the 'Map Information section'. Step 3 click save map and see the changes.

How do you zoom in smoothly on Google Maps?

The shortcut is simple: just double-tap the maps interface, but instead of lifting your finger after the second tap (the shortcut for zooming in), you leave it touching the screen. Then a swipe up zooms out, and a swipe down zooms in.


1 Answers

Setting [scrollwheel]="null" seems to work for now.

like image 160
Martti Käärik Avatar answered Sep 23 '22 09:09

Martti Käärik