1

Our company uses a 'ArcGIS for Javascript' custom-developed map that was built on Dojo a few years ago. It has the 'usual' tools (Identify, Measure, etc) but the listeners won't release the tools.

I feel like the reason is because the maps are built on Dojo 1.4 (I believe Dojo is at version 1.9.x) and ArcGIS for Javascript 2.3 and 3.0 and so we are dealing with scalability issues from modern browsers translating older javascript.

Is there a means of checking this or adjusting these listeners without completely rebuilding everything?

2
  • 1
    The latest release of Dojo as of 5/1/2014 is 1.9.3. I think you mean ArcGIS JavaScript API v2.9 (which is now at 3.9), which is built on Dojo. What do you mean by "the listeners won't release the tools"? – greenlaw May 1 '14 at 17:14
  • When the user clicks on the 'Select by Circle' button it creates a circle at click-point. If they select the Measure tool after doing a 'Select by Circle' then when they click to start the Measure tool, each click activates the 'Select by Circle' at each Measure click-point. – randomblink May 5 '14 at 15:59
0

I may need a bit more information (code sample would help), but extrapolating from your most recent comment, it sounds like your 'Select by Circle' tool/widget is not being deactivated properly when the Measure widget is selected.

Since both tools should be mutually exclusive, you may want to add an 'onclick' listener to the measure button(s), which will call some sort of deactivate() function on your Select by Circle tool. Likewise, you'll want to add a listener to your Select by Circle button that deactivates the Measure tool(s).

Maybe something like this?:

var measureButton = dom.byId("measureButtonId");
measureButton.onclick = function() {
    selectByCircleTool.deactivate();
};

var selectByCircleButton = dom.byId("selectByCircleId");
selectByCircleButton.onclick = function() {
    measurementWidget.setTool("location", false);
    measurementWidget.setTool("area", false);
    measurementWidget.setTool("distance", false);
};
1
  • 1
    What it turned out to be is the Measure tools were an offsite widget that was accessed via URL. So all of the Measure code ran from elsewhere. I just attached an onClick event to the Measure Widget and created a Listener killer function that ran from that onClick. Then I also added that function all of the other buttons as well. The original coders disconnected Listeners only partially and not for all the necessary buttons neither. I hate fixing other peoples code... especially when they got paid WAY TOO much for it and I could have done it for a 1/5 of the price. Ugh. – randomblink May 15 '14 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.