undocumented hit testing behavior on 10.2

Discussion created by bernese on Dec 13, 2013
Latest reply on Jan 9, 2014 by njarecha-esristaff
As requested in the 10.2 sticky thread, I am posting a test harness (see attached .zip) that shows undocumented hit testing behavior changes in 10.2. The test harness creates a basic map with one AGSTiledMapServiceLayer and one AGSGraphicsLayer. The AGSGraphicsLayer contains a single rectangular test graphic that is initially symbolized/filled with the default system color [UIColor redColor] and an alpha value of 1.0. A segmented control is provided that will toggle the alpha value to several values falling between 1.0 and 0.0, and some simple hit testing feedback is provided via on-screen labels, the presentation of a callout, and NSLog statements.

In using this test harness with 10.2, I see the following behavior:

  • Case of alpha = 1.0 OR 0.01 : Hits detected on perimeter and interior of test graphic.

  • Case of alpha = 0.0001 OR 0.0 : Hits detected on perimeter but not on interior of test graphic.

So, it appears that at some value approaching 0.0, the SDK decides that the alpha is effectively 0.0 and also starts passing hits through without assigning them to the graphic. Also, even at very low alpha values that still intercept touches, the fill is very slightly visible. I would like to be able to use a truly transparent fill (and outline, actually) and still catch interior taps.

Prior to 10.2, invisible areas of graphics caught hits and tehcnobrat's comment from the 10.2 sticky thread indicates this is unexpected behavior:
[INDENT]"We haven't changed the hit-testing mechanism to ignore transparent fills. I am unable to reproduce the behavior you described.
Could you please start a new thread and provide some code to repro?"[/INDENT]

Ideally, it seems like developers should be able to set a flag causing hit testing to either use or ignore the alpha value. On the project that led me to report this behavior, I would really like "invisible" graphics to still catch touches because they are sitting over a tiled map service that gives the user a really good idea of where they would like to tap and looks a lot better than a collection of visible graphics. However, I can see myself wanting the opposite behavior for a different use case involving city boundaries or the like.

Thanks, and apologies for the belated response; I've been swamped at work and am trying to maintain some semblance of work-life balance :p