esri.toolbars.Navigator defect

534
2
08-17-2012 08:07 AM
CoreyAlix
Occasional Contributor
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.
0 Kudos
2 Replies
derekswingley1
Frequent Contributor
Please provide some more context for what you're describing. What is the overarching issue? Can you provide a repro case to show the bug?
0 Kudos
CoreyAlix
Occasional Contributor
Apologies - thought this was due to moving from 3.0 to 3.1 but I now see that code is unchanged.  Must be a user error on my end.
0 Kudos