Hi
I have a site. It was using 3.11, now the highest 3.30, pending some more refactoring to get it to 4.x
There is a measure tool. It no longer gives a result when the mouse is moved around. Only when the mouse is clicked.
It still works if I go back to 3.11
I have added this
measurement.on("measure-end", function (evt) {
console.log("Really done.");
// measurement.setTool(evt.toolName, false);
enableID()
});
measurement.on("measure", function (evt) {
console.log("moved");
// measurement.setTool(evt.toolName, false);
});
According to the API ref "measure" event should be when the mouse moves
"Fires any time the mouse pointer moves while doing a distance measurement. (Added at v3.11). Note: Prior to v3.16, this event only fired on single-click."
Yet on my new code I only get an output when I click - so showing the pre-v3.16 behaviour.
I've stripped my code back as far as I can - I had added stuff to change the default units and to add more, and still the same behaviour. I have compared my code with the sample, but can't see anything.
What am I missing here?
Cheers
ACM
Edit: I stripped the Esri sample right down and now got a working version and a broken version - the broken version uses one of our services as the basemap, so in British National Grid. And, yes, we have a Geometry service defined.
Hi @AdrianMarsden, thanks for reporting this issue. I'm not sure I understand the problem though, as it seems to work as expected in the official 3x Measurement dijit (the current 3x version is 3.34) sample: https://developers.arcgis.com/javascript/3/samples/widget_measurement/index.html
No, sorry, it doesn't. On the working version you click to start the measure. Then as you move the mouse the distance from the first point to the current mouse location is dynamically calculated in the results, so changes as you move the mouse.
In the non-working version you only get the node-to-node distance when you click
I've just done more testing and this broke in 3.14 - this page uses 3.13 and works
https://maps.strata.solutions/eddc/test/failmaybe.html
The dynamic measure is import for our users as they need to see what is X metres away from a point, rather than how far are these two point from each other. So they will click, then move the mouse until the measure tool says the number they are working with.
The only thing I can see in the release notes for 3.14 is
"BUG-000085838: Fixed an issue where polar projection coordinates displayed incorrectly when using the measurement widget."
It is even more obvious with the location tool, which will return long/lat as you move the mouse around. On the fail site
https://maps.strata.solutions/eddc/test/fail.html
It only returns these on a mouse click
Cheers
ACM
More samples
https://maps.strata.solutions/eddc/test/work.html
This is more or less the Esri sample with a few consoles.logs added one on the measure.end and one on the measure - remember the measure event "Fires any time the mouse pointer moves while doing a distance measurement."
Look at the console after the first mouse click for a line measurement. It sends loads of "moved" values
Now look at
https://maps.strata.solutions/eddc/test/failmaybe.html
This is the sample using 3.13.
Do a line measure. After the first click, as you move the mouse the distance from the first click is outputted into the widget fine (change to feet to get some bigger numbers)
HOWEVER - the console.log which fires off with the measure event is only firing when you click the mouse, not when it is moved. Not crucial as the output is working.
Finally
https://maps.strata.solutions/eddc/test/fail.html
This is the total fail version with anything newer than 3.14
Again, length measure. One click, move the mouse - no distance until that second click, then the result only gets updated on the mouse click, rather than mouse move. output from the "measure" even is the same as the partial fail above.
I hope that helps. Now time to stop for the day 🙂
To me it looks like the "measure" event is broken when the Projection of the map isn't a standard one, as that is the only thing that is different and as can be seen from the console.log on those examples, very different results show.
Any thoughts?
I have had this from Esri(UK) - so I guess I've got to go back to 3.13 for my main site - In no way have I the time or skills to get to 4.x ☹️
BUG-000103128 : Measurement widget's 'measure' event shows incorrect behavior when using a non-mercator projection
the development team had already looked at it as closed it as a known issue and would not be addressing in 3.x