Thanks for the ideas Tom. I was working with them and am still having problems. Anytime I remove the "measure" event, the script no longer knows what do when in the midst of the active measuring. What I'm trying to do is add a segment length shown each time a user clicks, while still showing the total length of all segments at "measure-end". I guess what I need is a way for it to know to measure but not to send any values until the map is clicked instead of sending values constantly as the mouse moves (basically overriding the new functionality of v3.16). Below is the code section that was functioning in version 3.15:
var segmentLength = 0; //used in measure tool to track last segment length
var PrevM = 0; //used in measure tool to track last total measurement
var Mtype = ''; //used to track measurement units for display
var measurement = new Measurement({
map: map,
defaultAreaUnit: Units.ACRES,
defaultLengthUnit: Units.FEET,
}, dom.byId("measurementDiv"));
measurement.startup();
measurement.on("measure-start", function (evt) {
segmentLength = 0;
PrevM = 0;
dom.byId('spanSegment').innerHTML = 'Segment Length: ' + segmentLength.toFixed(1) + ' ' + Mtype;
});
measurement.on("measure", function (evt) {
var myVal = evt.values; //total measurement value
segmentLength = myVal - PrevM; //new segment value
PrevM = myVal; //remember current total measurement for next click
dom.byId('spanSegment').innerHTML = 'Segment Length: ' + segmentLength.toFixed(1) + ' ' + Mtype;
});
measurement.on("measure-end", function (evt) {
var myVal = evt.values;
segmentLength = myVal - PrevM;
dom.byId('spanSegment').innerHTML = 'Segment Length: ' + segmentLength.toFixed(1) + ' ' + Mtype;
segmentLength = 0;
PrevM = 0
});
measurement.on("tool-change", function (evt) {
dom.byId('spanSegment').innerHTML = ''; //zero out current values
Mtype = evt.unitName;
});
measurement.on("unit-change", function (evt) {
Mtype = evt.unitName;
});