Tap gesture should not work over non-edge areas

This commit is contained in:
Ali
2020-02-21 22:46:15 +04:00
parent 7c0a92bfb2
commit 37123fdb13

View File

@@ -149,6 +149,24 @@ public final class GalleryPagerNode: ASDisplayNode, UIScrollViewDelegate, UIGest
guard let strongSelf = self else {
return .fail
}
let size = strongSelf.bounds
var highlightedSide: Bool?
if point.x < edgeWidth && strongSelf.canGoToPreviousItem() {
if strongSelf.items.count > 1 {
highlightedSide = false
}
} else if point.x > size.width - edgeWidth && strongSelf.canGoToNextItem() {
if strongSelf.items.count > 1 {
highlightedSide = true
}
}
if highlightedSide == nil {
return .fail
}
if let result = strongSelf.hitTest(point, with: nil), let node = result.asyncdisplaykit_node as? ASButtonNode {
return .fail
}