It looks like MapView.hitTest() is not returning any results for polygon features with fully transparent fill. This screenshot shows click locations and hitTest results filtered on layer title (filter should be fine) for two polygons in the same layer.
It looks like there was a similar issue around 4.5 with polygon fills of any transparency, but apparently the fix did not cover fully transparent polygons. If there's not something wrong with my setup, then transparent fill polygons essentially act like polylines for the purpose of hitTesting.
> Running 4.29
Hi there,
I am not able to reproduce the behavior you describe. Here is a codepen showing hitTest returning results with no fill - https://codepen.io/U_B_U/pen/YzbPKrO?editors=100
The behavior does occur if you set the style property to "none"...perhaps that's what's going on.
Ah! I am able to reproduce the issue. I will update you once we fix the issue. Thank you for reporting this issue.
Hi there,
So I was wrong to say that it is a bug at 4.29. It turns out that if the style is none, the JS API assumes there is no fill and so nothing is returned in the hit test unless the user clicks the outline. The correct behavior is to update your code by setting a transparent fill if you want a hit returned.
Sorry about the confusion.
Thanks Undral and Joel. Okay, I can see some instances where you want to make only the outline of a polygon clickable for a hit test by giving it style: "none". It appears hitTest also doesn't provide results for CIMPolygonSymbols with only a CIMSolidStroke defined. I don't know how symbols on my webmap ended up with vector fill polygons with no fill defined, but they did.
A follow up question would be whether the Map Viewer UI should have the option to add fill symbology if none are initially defined. I had to restart with a new Vector polygon before I would see an option to change the fill properties.