Users can choose the mouse, keyboard, and sliders for panning and zooming a map, depending on what is enabled in the HTML page. By default, users can do the following:
You can disable any of these options by using one of several Map methods. The following table lists:
var map = ...;
dojo.connect(map, "onLoad", function() {
map.disablePan();
});
| Methods | Property | Description |
|---|---|---|
| enablePan(), disablePan() | isPan | When enabled, users can pan the map using the mouse.
|
| enableScrollWheelZoom(), disableScrollWheelZoom() | isScrollWheelZoom | When enabled, users can use the mouse scroll wheel to zoom in and out.
|
| enableRubberBandZoom(), disableRubberBandZoom() | isRubberBandZoom | When enabled, users can draw a bounding box to zoom in or out from the map using the mouse.
|
| enableClickRecenter(), disableClickRecenter() | isClickRecenter | When enabled, users can double click on a map to recenter and zoom in a level.
|
| enableDoubleClickZoom(), disableDoubleClickZoom() | isDoubleClickZoom | When enabled, users can double click on a map to recenter and zoom in a level.
|
| enableShiftDoubleClickZoom(), disableShiftDoubleClickZoom() | isShiftDoubleClickZoom | When enabled, users can shift + double click on a map to recenter and zoom in a level.
|
| enableKeyboardNavigation(), disableKeyboardNavigation() | isKeyboardNavigation | When enabled, users can pan using the arrow keys and zoom using the + and - keys on the keyboard.
|
| showPanArrows(), hidePanArrows() | isPanArrows | Shows or hides the pan arrows on the map. |
| showZoomSlider(), hideZoomSlider() | isZoomSlider | Shows or hides the zoom slider on the map. |
| enableMapNavigation(), disableMapNavigation() | none | Enables or disables all map navigation except the pan arrows and slider. |
In addition to methods and properties related to mouse and keyboard operations, methods are also available to pan and center the map based on user input or code driven. Methods available for panning in this matter are:
You do not need to use these pan methods for the default pan arrows on the map since the pan functions are already built in. However, if you need to create a custom pan operation, these methods are available to you.
You can programmatically recenter a map based on user input using the centerAt() and panTo() methods.
Depending on your application, you can decide if it is easier to work in screen or map coordinates.
These methods are in addition to the Shift + Click option available to users for recentering a map.