coreyalix01

esri.toolbars.Navigator defect

Discussion created by coreyalix01 on Aug 17, 2012
Latest reply on Aug 17, 2012 by coreyalix01
UPDATE 2: Please disregard - it seems it is not possible to activate a tool until the map is loaded.  In the code below map.graphics is defined when the toolbar is activated.  My issue is I'm activating the toolbar before the map is loaded.

require(["dojo/_base/window", "dojo/aspect"], function (win, aspect) {
 var esri = win.global.esri;

 var initExtent = new esri.geometry.Extent({ "xmin": -122.46, "ymin": 37.73, "xmax": -122.36, "ymax": 37.77, "spatialReference": { "wkid": 4326} });
 var map = new esri.Map("map", {
  extent: esri.geometry.geographicToWebMercator(initExtent)
 });

 aspect.after ( map, "onLoad", function () {
  var navToolbar = new esri.toolbars.Navigation ( map );
  navToolbar.activate ( esri.toolbars.Navigation.PAN );
 });

 var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
 map.addLayer(basemap);
 
});


UPDATE 1: explanation below is bogus but it is true that map.graphics is null at the time this code executes.

The activate method contains this code:

            if (!this._graphic) {
              this._deactivateMapTools(true, false, false, true);
              this._graphic = new esri.Graphic(null, this.zoomSymbol);
            }


But the _deactivateMapTools looks like this:

          _deactivateMapTools: function(nav, _926, _927, _928) {
            var map = this.map;
            if (nav) {
...
            }
            if (_926) {
              map.hideZoomSlider();
            }
            if (_927) {
              map.hidePanArrows();
            }
            if (_928) {
              map.graphics.disableMouseEvents();
            }
          },


Notice that _deactivateMapTools  is only called when !map.graphics yet the fourth parameter (_928) is true and therefore map.graphics.disableMouseEvents() is attempted.

Outcomes