require(["esri/toolbars/navigation"], function(Navigation) { /* code goes here */ });
Description
(Added at v1.0)
Toolbar that supports basic navigation such as pan and zoom.
Samples
Search for
samples that use this class.
Constructors
Constants
PAN | Map is panned. |
ZOOM_IN | Map zooms in. |
ZOOM_OUT | Map zooms out. |
Methods
Events
[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
Constructor Details
Creates a new Navigation object. A Map is a required parameter.
Parameters:
<Map > map |
Required |
Map the toolbar is associated with. |
Sample:
require([
"esri/map", "esri/toolbars/navigation", ...
], function(Map, Navigation, ... ) {
var map = new Map( ... );
var navToolbar = new Navigation(map);
...
});
Method Details
Activates the toolbar for map navigation. Activating the toolbar overrides default map navigation.
Parameters:
<String > navType |
Required |
The navigation type. The Constants table lists valid navigation values. |
Deactivates the toolbar and reactivates map navigation.
When "true", map is at the first extent.
Sample:
require([
"esri/map", "esri/toolbars/navigation", "dijit/registry", ...
], function(Map, Navigation, registry, ... ) {
var map = new Map( ... );
var navToolbar = new Navigation(map);
registry.byId("zoomprev").disabled = navToolbar.isFirstExtent();
...
});
When "true", map is at the last extent.
Sample:
require([
"esri/map", "esri/toolbars/navigation", "dijit/registry", ...
], function(Map, Navigation, registry, ... ) {
var map = new Map( ... );
var navToolbar = new Navigation(map);
registry.byId("zoomnext").disabled = navToolbar.isLastExtent();
...
});
Set the SimpleFillSymbol used for the rubber band zoom.
Parameters:
<Symbol > symbol |
Required |
The SimpleFillSymbol used for the rubber band zoom. |
Sample:
require([
"esri/map", "esri/toolbars/navigation", ...
], function(Map, Navigation, ... ) {
var map = new Map( ... );
var navToolbar = new Navigation(map);
navToolbar.setZoomSymbol(zoomSymbol);
...
});
Zoom to initial extent of base layer.
Zoom to next extent in extent history.
Zoom to previous extent in extent history.
Event Details
[ On Style Events | Connect Style Event ]
Fires when the extent history changes. (Added at v3.6)
Sample:
require([
"esri/toolbars/navigation", "dijit/registry", ...
], function( Navigation, registry, ... ) {
function init(){
navToolbar = new Navigation(map);
navToolbar.on("extent-history-change", extentHistoryChangeHandler);
}
function extentHistoryChangeHandler() {
registry.byId("zoomprev").disabled = navToolbar.isFirstExtent();
registry.byId("zoomnext").disabled = navToolbar.isLastExtent();
}
...
});
Fires when the extent history changes.
Sample:
function init{
navToolbar = new esri.toolbars.Navigation(map);
dojo.connect(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);
}
function extentHistoryChangeHandler() {
dijit.byId("zoomprev").disabled = navToolbar.isFirstExtent();
dijit.byId("zoomnext").disabled = navToolbar.isLastExtent();
}