Hi
II have a widget
var measurement = new esri.dijit.Measurement({
map: map,
defaultAreaUnit: esri.Units.SQUARE_METERS,
defaultLengthUnit: esri.Units.METERS
}, dojo.byId('measurementDiv'));
//measurement.hideTool("location");
measurement.on("measure-end", function (evt) {
console.debug("Really ended?")
this.setTool(evt.activeTool, false);
enableID();
});
measurement.startup();
Define as above.
However the measure-end event is fired after each node of an area measure from the third node onwards. There follows a large error message
The task does, however keep going when area is being measured.
"TypeError: undefined is not a function at http://x/common/init.js?123:185:14 at null.<anonymous> (http://x/arcgis_js_api/library/3.10/3.10/init.js:777:175) at h.(anonymous function).g [as onMeasureEnd] (http://x/arcgis_js_api/library/3.10/3.10/init.js:239:390) at s._showArea (http://x/arcgis_js_api/library/3.10/3.10/js/esri/dijit/Measurement.js:35:330) at s._outputArea (http://x/arcgis_js_api/library/3.10/3.10/js/esri/dijit/Measurement.js:35:181) at null.<anonymous> (http://x/arcgis_js_api/library/3.10/3.10/init.js:173:473) at h.(anonymous function).g [as onAreasAndLengthsComplete] (http://x/arcgis_js_api/library/3.10/3.10/init.js:239:390) at e._successHandler (http://x/arcgis_js_api/library/3.10/3.10/init.js:490:174) at e._areasAndLengthsHandler (http://x/arcgis_js_api/library/3.10/3.10/init.js:916:267) at http://x/arcgis_js_api/library/3.10/3.10/init.js:174:23"
Strange? Or my fault?
ACM
UPDATE
Using the older dojo.connect
dojo.connect(measurement, "onMeasureEnd", function (activeTool, geometry) {
this.setTool(activeTool, false);
enableID();
});
And the event fires, as before on the third click, for area, but doesn't have the error, and re-enables my ID task.
It looks like the new widget is firing the OnMeasureEnd event each time a result for the area is required - the old tool only got the result on double click - ending the drawing.
the code worked fine in 3.8 & 3.9