AnsweredAssumed Answered

map.navigationManager missing with optimized build of API

Question asked by bb1769 on Jan 15, 2015
Latest reply on Jan 16, 2015 by bb1769

We're using a custom build of the JS API generated with the Web Optimizer (jso.arcgis.com). It's been working OK (though I had to add some missing modules manually that the dependencies didn't pick up - could see those in the browser debugger when it tried to retrieve missing module files).

 

Now I'm adding in a drawing toolbar. The toolbar initializes, but when I call the toolbar.activate method, I get an error:

 

Cannot read property 'setImmediateClick' of undefined

 

If I step into the custom dojo.js code, I see the error is occurring in this statement of the draw tool:

 

c.navigationManager.setImmediateClick(!1);

 

Here the "c" is a reference to the map object.

 

I looked at the sample at Add graphics to a map | ArcGIS API for JavaScript, which uses the draw toolbar but the standard JS API source, and stepped into the .activate method, and can see that the map.navigationManager.setImmediateClick() goes into a esri/MapNavigationManager class. That is obviously missing from my application. However, I don't see that module available in the web optimizer. I also ensured that the modules mentioned in the sample are included in my build. Any ideas on how to add that module to my map with the web-optimizer build?

 

EDIT: I created a custom build for the above-mentioned graphics sample. I started from the option to manually specify modules, and chose the compact build as the starting point. I added the modules listed in the sample. I set up the sample to use this custom build. On a side note, when I first ran with this custom build, I got errors. I had to add two more modules to get it to run at all: dojo/gfx/svg and esri/dijit/Attribution.

 

With this updated custom build, the graphics sample ran fine, and I could draw graphics. I stepped into the code and can see that the map.navigationManager is populated and works. I compared it to my application's custom build, and added a couple of modules so that my app used all the ones in the sample's build. However, that custom build still fails - no map.navigationManager. More mystifying than before.

Outcomes