I don't want to allow multiselect (shift + click) in my SketchViewModel, i.e., the user should not be allowed to select more than one graphic at a time. How to disable multiselect for SketchViewModel with ArcGIS JavaScript API 4.10?
Update 1: The following code seems to do the trick, but it's kind of a hack:
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>sketchViewModel<SPAN class="punctuation token">.</SPAN>updateGraphics<SPAN class="punctuation token">.</SPAN><SPAN class="token function">watch</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"length"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN>e<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>sketchViewModel<SPAN class="punctuation token">.</SPAN>updateGraphics<SPAN class="punctuation token">.</SPAN>length <SPAN class="operator token">></SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>sketchViewModel<SPAN class="punctuation token">.</SPAN><SPAN class="token function">cancel</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// Or some other action</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Update 2: With ArcGIS JS API 4.11, you can now do this:
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>sketchViewModel<SPAN class="punctuation token">.</SPAN>defaultUpdateOptions<SPAN class="punctuation token">.</SPAN>multipleSelectionEnabled <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>