Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward hitTest:withEvent and piontInside:withEvent: to node within _ASCollectionViewCell #1268

Merged
merged 1 commit into from
Dec 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Source/Details/_ASCollectionViewCell.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//

#import <AsyncDisplayKit/_ASCollectionViewCell.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>

#import <AsyncDisplayKit/ASCellNode+Internal.h>
#import <AsyncDisplayKit/ASCollectionElement.h>
Expand Down Expand Up @@ -94,6 +95,29 @@ - (void)layoutSubviews
self.node.frame = self.contentView.bounds;
}

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
/**
* The documentation for hitTest:withEvent: on an UIView explicitly states the fact that:
* it ignores view objects that are hidden, that have disabled user interactions, or have an
* alpha level less than 0.01.
* To be able to determine if the collection view cell should skip going further down the tree
* based on the states above we use a valid point within the cells bounds and check the
* superclass hitTest:withEvent: implementation. If this returns a valid value we can go on with
* checking the node as it's expected to not be in one of these states.
*/
if (![super hitTest:self.bounds.origin withEvent:event]) {
return nil;
}

return [self.node hitTest:point withEvent:event];
}

- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event
{
return [self.node pointInside:point withEvent:event];
}

@end

/**
Expand Down