Select to view content in your preferred language

Indicate if HitTest result graphic is feature symbol or label

145
0
09-11-2024 02:49 PM
Status: Open
Labels (2)
jdyerLACSD
Emerging Contributor

By default, mapView.hitTest will return a feature if there was a hit on the feature's symbol, including any visible label. Sometimes this behavior is desired, but there may be instances, for example, where a developer would like a user to be able to select a feature by clicking on its symbol, but not by clicking on its label. Since labelingInfo label classes don't have the robust auto-placement functionality based on feature weights that labels created in Esri's desktop software do, a user could easily accidentally click on the label of a nearby feature instead of the line geometry for a separate feature underneath the label.

I would like to request a way for the developer to determine whether the ViewHit was the actual feature graphic or its label.  Then the developer could choose whether or not they want to proceed with the highlight/popup/etc.

As far as implementation, one solution could be to add a property like graphicPart to GraphicHit. Alternatively, MapView.hitTest() -> options -> exclude could also accept a symbol type, so all results of that type will be excluded.