Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable two fingers zoom option in Maps in mobile devices using JavaScript API?

Tags:

My Google Maps options are like

{     center: userLatLng,     zoom: 13,     mapTypeId: 'roadmap',     scrollwheel: false,     navigationControl: false,     mapTypeControl: false,     scaleControl: false,     draggable: true,     mapTypeId: google.maps.MapTypeId.ROADMAP,     disableDefaultUI: true,     disableDoubleClickZoom: false,     zoomControl: false,     styles: styles['hide'],     componentRestrictions: {country: "in"}, } 

On mobile, this message is displayed:

Use two fingers to move the map

If I use two fingers, I can move the map and also zoom it.

How to make that a single finger can move the map, but not zoom the map?

like image 385
Raghavendra S Avatar asked Jan 24 '17 14:01

Raghavendra S


People also ask

How do I turn off zoom on Google Maps?

You can use the setOptions() method on the map object: map. setOptions({draggable: false, zoomControl: false, scrollwheel: false, disableDoubleClickZoom: true});

How can we enable or disable the zoom in the map in Android Studio?

The Maps API provides built-in zoom controls that appear in the bottom right hand corner of the map. These are disabled by default, but can be enabled by calling UiSettings. setZoomControlsEnabled(true) .

How do I control zoom on Google Maps?

Users can zoom the map by clicking the zoom controls. They can also zoom and pan by using two-finger movements on the map for touchscreen devices.

How do I change the default 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.


1 Answers

Add gestureHandling: "greedy" to your map options.

Here is the documentation about this option: gestureHandling

like image 191
Fran Avatar answered Oct 05 '22 03:10

Fran