Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: Navigation

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

NameSummary
new Navigation(map)Creates a new Navigation object.

Constants

NameDescription
PANMap is panned.
ZOOM_INMap zooms in.
ZOOM_OUTMap zooms out.

Methods

NameReturn typeSummary
activate(navType)NoneActivates the toolbar for map navigation.
deactivate()NoneDeactivates the toolbar and reactivates map navigation.
isFirstExtent()BooleanWhen "true", map is at the first extent.
isLastExtent()BooleanWhen "true", map is at the last extent.
setZoomSymbol(symbol)NoneSet the SimpleFillSymbol used for the rubber band zoom.
zoomToFullExtent()NoneZoom to initial extent of base layer.
zoomToNextExtent()NoneZoom to next extent in extent history.
zoomToPrevExtent()NoneZoom to previous extent in extent history.

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.

Events

NameEvent ObjectSummary
extent-history-changeFires when the extent history changes.
Constructor Details

new Navigation(map)

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

activate(navType)

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.

deactivate()

Deactivates the toolbar and reactivates map navigation.

isFirstExtent()

When "true", map is at the first extent.
Return type: Boolean
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();
  ...
});

isLastExtent()

When "true", map is at the last extent.
Return type: Boolean
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();
  ...
});

setZoomSymbol(symbol)

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);
  ...
});

zoomToFullExtent()

Zoom to initial extent of base layer.

zoomToNextExtent()

Zoom to next extent in extent history.

zoomToPrevExtent()

Zoom to previous extent in extent history.
Event Details
[ On Style Events | Connect Style Event ]

extent-history-change

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();
  }
  ...
});
Show Modal