Hi - I'm trying to access the graphic attribute of a hitTest on a graphicsLayer. The code below was working with 4.22, but not now at 4.24
// Search for graphics at the clicked location
a.view.hitTest(screenPoint).then(function (response) {
if (response.results.length) {
var graphic = response.results.filter(function (result) {
// check if the graphic belongs to the layer of interest
return result.graphic.layer === a.graphicsLayer;//at 4.24 this does not compile Property 'graphic' does not exist on type 'ViewHit'
//try this as hitTestResult is array of result objects at 4.24
return result[0].graphic === a.graphicsLayer;// TypeError: Cannot read properties of undefined (reading 'graphic')
})[0].graphic;
//call method on form component to open closeout form work order
a.comService.WorkOrderClickedOnMap(graphic.attributes.WorkOrderID);
}
});
strangely, when I break on result I see a graphic property (see below). Any ideas how to get this to work?
Thanks
Pete