GeometryService acting strangely on Measure Polyline mouse events

336
1
03-27-2019 12:08 PM
LoriEmerson_McCormack
Occasional Contributor

We use the measure tool to show intermediate segment values and then the total value.  Has the setting of the single mouse click and the double mouse click changed?  Has the setting of the mouse-move changed?  The mouse events seem to be affected by the GeometryService changes or arcgisonline change that occurred last week.

For example, when using our internal Geometry Service,

or this URL:  utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer,

or this URL:  tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer

our code keeps returning values as though the mouse is still moving after double-clicking on the map to end the polyline measurement.  For example, each mouse click adds "Segment".  Each mouse-move displays both "Total Length" and "Current Length".  A double-mouse click removes the "Total Length" and "Current Length" and then adds the final "Total Length".  However, the problem is that after the double-mouse click, the first "Total Length" and "Current Length" stay and the two numbers keep changing randomly even though the mouse isn't moving.  After a while (3 to 15 seconds), the random numbers stop.

When using the URL tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer, 

The problem appears to start after the following lines of code are executed:

map.graphics.clear();

undoManager.clearRedo();

undoManager.clearUndo();

When using the other two URLs, the problem may occur right away or after clearing the all the graphics.  Note:  I cleared my browser cache between tests.  If I don't clear the cache, then once the problem starts it persists.

A secondary problem:

The double-mouse click registers as a single-mouse click, and adds an extra "Segment" line as show above.  In the example above, I double-clicked on the map to end the line at Segment 3, but Segment 4 was added with a slightly higher length than segment 3.

This code has been working for a long time, and is still using API version 3.16.  Is this version still being supported, or has something changed?

0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor

If you are using the geometry service on mouse move, my guess is you are probably queuing up a number of requests and what you are seeing is all those requests finishing after you think you are done. You may want to debounce those requests so it's not on every mouse move but only every 500ms or so. You can probably see this by looking at the network traffic in your browsers developer tools.