Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable/enable dragging, zooming and change the cursor in Google maps v3

how can i disable/enable dragging, zooming in a 'map' object. also how can i change the cursor to for example a plus sign and then change it back to default.

I have tried these but doesn't work:

 map.google.maps.MapOptions.disableDoubleClickZoom = true;
map.google.maps.MapOptions.draggable = false;
like image 804
Sami Al-Subhi Avatar asked Nov 20 '11 05:11

Sami Al-Subhi


1 Answers

You have two options how to set map options:

map = new google.maps.Map({ draggable : false }); // upon initialization
map.setOptions({ draggable : false }); // or in runtime
  • to disable the zoom you may try to use minZoom and maxZoom options (set them to the same value as zoom option), or you may try to set zoomControl to false,

  • to change the cursor which is displayed over the map use draggableCursor option, i.e. map.setOptions({ draggableCursor: 'crosshair' });. To change back to default just set it to null: map.setOptions({ draggableCursor: null });.

like image 176
Tomas Avatar answered Sep 30 '22 12:09

Tomas