HitTestAsync for invisible graphics

2039
1
Jump to solution
12-09-2015 10:21 AM
ChristinaKochan1
Occasional Contributor

I am calling HitTestAsync(MapView, Point) from within a MapViewTapped handler. On the first click, the Graphic g is found, so I set g.IsSelected=true. On the second click, it is found again, so I put it in edit mode by calling Editor.EditGeometryAsync(g) and I set g.IsVisible=false so that only the editing version is visible. This all works. However, when I click a third time, the hit test returns null, which I'm assuming is because the shape is invisible. I don't want to deselect the graphic, but since it isn't found with a hit test, there is no way to know if it's been clicked, so my selector logic deselects everything thinking that nothing was clicked.

Is there a way to convince the hit test to see my invisible graphic or see the graphic on the Editor layer? Right now the only thing I know to do is to set the Symbol colors for the graphic to Transparent instead of setting it to invisible so that the hit test will still find it but it won't be seen on the map, but that seems hacky.

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

> Is there a way to convince the hit test to see my invisible graphic

No. The hit test is done based on the rendering of the features. If they aren't visible, they aren't hittable.

View solution in original post

0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

> Is there a way to convince the hit test to see my invisible graphic

No. The hit test is done based on the rendering of the features. If they aren't visible, they aren't hittable.

0 Kudos