In my project, I am utilizing Google Maps but I want to disable the zooming effect on the map. To achieve this, I have disabled the zoom control using zoomControl: false,
. However, this modification only applies to desktops and laptops as they do not support multi-touch functionality.
When accessing the map on devices such as tablets or smartphones that support multi-touch, I am still able to pinch and zoom despite the previous settings.
I attempted using
map2.getUiSettings().setZoomControlsEnabled(false);
with no success in preventing pinch and zoom gestures.
Furthermore, I tested
map.getUiSettings().setZoomControlsEnabled(false);
to check for any differences, but the issue persisted.
If anyone could provide some guidance on this matter, it would be greatly appreciated.
Below is my complete code:
<script>
function showCurrentLocation(position) {
var latitude = <?php echo $curLat; ?>;
var longitude = <?php echo $curLon; ?>;
var coords2 = new google.maps.LatLng(latitude, longitude);
var mapOptions2 = {
zoom: 10,
center: coords2,
mapTypeControl: false,
streetViewControl: false,
panControl: false,
zoomControl: false,
scrollwheel: false,
navigationControl: false,
mapTypeControl: false,
scaleControl: false,
draggable: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
// Create the map and display it in the HTML map div
map2 = new google.maps.Map(
document.getElementById("mapPlaceholder"), mapOptions2);
// Place the initial marker
var marker2 = new google.maps.Marker({
position: coords2,
map: map2,
title2: "Current location!"
});
}
google.maps.event.addDomListener(window,'load',showCurrentLocation);
map2.getUiSettings().setZoomControlsEnabled(false);
</script>
Any assistance on resolving this issue would be highly valued.