When using hitTestSlop to extend the hit area of an ASControlNode subclass, I've noticed that tapping outside the bounds (with a small tolerance) causes the node to highlight without triggering a TouchUpInside event.
The following code in ASControlNode seems to only take the original bounds + a hardcoded inset into account when determining whether to send the touch up inside event or not.
CGRect expandedBounds = CGRectInset(self.view.bounds, kASControlNodeExpandedInset, kASControlNodeExpandedInset);
BOOL touchUpIsInsideExpandedBounds = CGRectContainsPoint(expandedBounds, touchLocation);
Is it possible that this should take the hitTestSlop into account, so that the final considered area is bounds + hitTestSlop + UIControlNode's expanded inset?
CGRectContainsPoint(UIEdgeInsetsInsetRect(expandedBounds, hitTestSlop), touchLocation)
Good catch! I believe the solution we want here, is to apply the hit test slop and _then_ apply kASControlNodeExpandedInset to get the bounds in this case.
@GitGadd - would you be willing to implement this for us?
@hannahmbanana Definitely! I've been thinking about contributing, and this seems like an easy start.
Pull request: https://github.com/facebook/AsyncDisplayKit/pull/2896
Most helpful comment
Good catch! I believe the solution we want here, is to apply the hit test slop and _then_ apply
kASControlNodeExpandedInsetto get the bounds in this case.