mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 913 forks source link

Note: Setting opt 'gestures' will loose defaults (e.g. MAP_MOVE not working) #2884

Open spoxies opened 2 years ago

spoxies commented 2 years ago

Please note this is not an issue, but just a note for those using a recent/experimental branch (e.g. multiple_maps): In recent versions when (some) gestures are defined/disabled it might/will disable all other gestures as well (on iOS).

For me I took some digging as it happend after an update. Though it was an HTML issue like (https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2819) but in my case it was not. I thought I might share to prevent other reports and research.

The snippet bellow will cause the map not be able to be moved/zoomed etc by the users touch events (as those gestures get disabled as well) even though only tilt set to false.

var div = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(div, {
  'gestures': {
    'tilt': false,
  }
});

So the 'correct' config to only disable tilt would be to set the other gestures to true:

var div = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(div, {
  'gestures': {
    'tilt': false,
    'scroll': true,
    'rotate': true,
    'zoom': true
  }
});