I have a map using the 3.21 JavaScript API that contains a Draw Toolbar and a Measurement widget. I would like to disable the Draw Toolbar when the Measurement widget is used so the user isn't drawing while measuring. I tried attaching to the tool-change event of the Measurement widget and deactivating the Draw Toolbar from there, but that's causing issues with the Measurement widget where the last segments of the area or distance measurements aren't added to the total. Is there a good way of deactivating the Draw Toolbar when using the Measurement widget?
Steve,
I am not sure what you have tried but this is how I would handle it:
aspect.after(measurement, 'setTool', lang.hitch(this, function() {
if (measurement.activeTool) {
//deactive the draw tool
} else {
//activate the draw tool
}
}));
Robert,
Thanks. I wasn't familiar with aspect and it seems super useful.
I gave this a try and I'm still having the issue with the measure tool not including the last segment of the line or area in the measurement after deactivating the draw toolbar.
Steven,
Can you put together a small sample app that demonstrates you issue. That way I can debug some actual code for you.
Steven,
This seems like a bug that you need to report to esri tech support.
Robert,
Thanks for the help. I'll get a support case going with esri.