From 96de7673bf5235697e279403ba25d447d09f803e Mon Sep 17 00:00:00 2001 From: Christian Selig Date: Tue, 4 May 2021 17:46:27 -0300 Subject: [PATCH] Add hitTest/pointInside support to table node --- Source/ASTableView.mm | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Source/ASTableView.mm b/Source/ASTableView.mm index 195cb183c..34c5db9d8 100644 --- a/Source/ASTableView.mm +++ b/Source/ASTableView.mm @@ -29,7 +29,7 @@ #import #import #import - +#import static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; @@ -287,6 +287,11 @@ @interface ASTableView () _asyncDelegate; __weak id _asyncDataSource; } @@ -2032,6 +2037,30 @@ - (void)didMoveToSuperview } } +- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event +{ + if (!_internalFlags.inHitTest) { + _internalFlags.inHitTest = YES; + UIView *hitView = [_tableNode hitTest:point withEvent:event]; + _internalFlags.inHitTest = NO; + return hitView; + } else { + return [super hitTest:point withEvent:event]; + } +} + +- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event +{ + if (!_internalFlags.inPointInside) { + _internalFlags.inPointInside = YES; + BOOL result = [_tableNode pointInside:point withEvent:event]; + _internalFlags.inPointInside = NO; + return result; + } else { + return [super pointInside:point withEvent:event]; + } +} + #pragma mark - Accessibility overrides - (NSArray *)accessibilityElements