Measurement Widget selects existing graphics in Graphic Layer (Sketch widget)

778
1
12-03-2021 01:34 PM
CameronBlandy
Occasional Contributor

I am trying to use both the Sketch and Measurement widgets in a single map view. I do not want the graphics to be editable once the graphic is drawn so I set updateOnGraphicClick to false on construction of the Sketch widget.

When I switch to a Measurement tool and click on the map view where the graphic is it selects the graphic and I am unable to do the measurement. If I click outside the graphic as the first measure point (line or area) and then click a point inside the graphic it seems to work fine. Is this the intended use of the Measurement widget?

I would like to think you can use the Measurement widget independently of the graphics on the map view.

I am using the 4.21 api.

0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

Hi @CameronBlandy, thanks for the question. Are you setting the "updateOnGraphicClick" property on the Sketch widget, or SketchViewModel? If you set it on the ViewModel, it seems to behave as expected.

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.ht...

test-app (with measure)

https://codepen.io/noash/pen/zYEqdbr?editors=1000

 

0 Kudos