4.21 SketchViewModel bug for click-based tools

174
2
11-08-2021 11:06 AM
JoelBennett
Occasional Contributor III

New to the 4.21 ArcGIS API for JavaScript is a bug that occurs when using click-based tools in the SketchViewModel module.  In particular, it occurs whenever the create method is called with createOptions.mode being set to "click", regardless of geometry type.  The problem itself is that a click from any mouse button is treated the same as a left-click.

This can be seen in the sample "Edit features with the Editor widget".  Select any feature type to create, and you can place or draw the feature the same way by using any mouse button.  If you use the sandbox to change the version to 4.20, only left-clicks are used to place or draw as one would expect.

This is not a problem for all workflows, but is for some.  For example, in one workflow, the create tool is repeatedly activated after each feature is created, so the user can continue creating features without manually clicking to activate every time.  At any time, the user may want to right-click an existing feature in the same or different layer, and choose from various actions in a right-click menu.  However, in 4.21, the right-click no longer results in a context menu being shown, but a new feature being unexpectedly created.

If you have a locally hosted copy of the API, my recommended workaround is to make the following change in the esri/views/draw/DrawOperation module:

Search for:

f._onImmediateClick=function(a){

 

Replace with:

f._onImmediateClick=function(a){if(a.button!==0)return;

 

0 Kudos
2 Replies
JoseBanuelos
Esri Contributor

Hello @JoelBennett ,

Thank you for reporting this. You are correct, this is a bug caused by some changes in version 4.21. Apologies for this, we are looking into this now, and hope to get this addressed in 4.22.

Thanks,

Jose

JoelBennett
Occasional Contributor III

I've found this to be fixed in 4.22...thank you

0 Kudos