Content of the material
Google Maps – Modifying Controls
Several of the map controls are configurable.
The controls can be modified by specifying control options fields.
For example, options for modifying a Zoom control are specified in the zoomControlOptions field. The zoomControlOptions field may contain:
- google.maps.ZoomControlStyle.SMALL – displays a mini-zoom control (only + and – buttons)
- google.maps.ZoomControlStyle.LARGE – displays the standard zoom slider control
- FAULT – picks the best zoom control based on device and map size
Note: If you modify a control, always enable the control first (set it to true).
Another configurable control is the MapType control.
Options for modifying a control are specified in the mapTypeControlOptions field. The mapTypeControlOptions field may contain::
- google.maps.MapTypeControlStyle.HORIZONTAL_BAR – display one button for each map type
- google.maps.MapTypeControlStyle.DROPDOWN_MENU – select map type via a dropdown menu
- FAULT – displays the "default" behavior (depends on screen size)
You can also position a control, with the ControlPosition property:❮ Previous Next ❯
If your mouse button’s sticky or unresponsive, you might find clicking the mouse buttons to control the map zoom level inconvenient or difficult. One alternative to double-click zooming in Google Maps is to use the on-screen graphical user interface controls. Change the zoom level with the slider control on the left-hand side of the Google Maps viewing screen, or single-click the “+” or “-“buttons at either end of the slider control to change the zoom level.
Google Maps – Disabling The Default Controls
You may instead wish to turn off the default controls.
To do so, set the Map’s disableDefaultUI property (within the Map options object) to true:
Here is a Gist I created to remind myself in the future about this quick fix:
And that is it – nice and simple.