From d28c3c27c6bd9ef95c03d84a761e5635295d0158 Mon Sep 17 00:00:00 2001 From: Vivian Qu Date: Mon, 29 Feb 2016 17:10:39 -0800 Subject: [PATCH 1/2] Account for contentInset when calculating ASScrollDirection --- AsyncDisplayKit/ASCollectionView.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 2bdbb1d641..61f41d46ef 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -622,10 +622,10 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; - (ASScrollDirection)nonFlowLayoutScrollableDirections { ASScrollDirection scrollableDirection = ASScrollDirectionNone; - if (self.contentSize.width > self.bounds.size.width) { // Can scroll horizontally. + if (self.contentSize.width + self.contentInset.left > self.bounds.size.width) { // Can scroll horizontally. scrollableDirection |= ASScrollDirectionHorizontalDirections; } - if (self.contentSize.height > self.bounds.size.height) { // Can scroll vertically. + if (self.contentSize.height + self.contentInset.top > self.bounds.size.height) { // Can scroll vertically. scrollableDirection |= ASScrollDirectionVerticalDirections; } return scrollableDirection; From 31b576ebcd872aae37f33747319f78ac4d75b6d0 Mon Sep 17 00:00:00 2001 From: Vivian Qu Date: Mon, 29 Feb 2016 17:49:26 -0800 Subject: [PATCH 2/2] Address comment --- AsyncDisplayKit/ASCollectionView.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 61f41d46ef..b6e22e222a 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -622,10 +622,10 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; - (ASScrollDirection)nonFlowLayoutScrollableDirections { ASScrollDirection scrollableDirection = ASScrollDirectionNone; - if (self.contentSize.width + self.contentInset.left > self.bounds.size.width) { // Can scroll horizontally. + if (self.contentSize.width + self.contentInset.left + self.contentInset.right > self.bounds.size.width) { // Can scroll horizontally. scrollableDirection |= ASScrollDirectionHorizontalDirections; } - if (self.contentSize.height + self.contentInset.top > self.bounds.size.height) { // Can scroll vertically. + if (self.contentSize.height + self.contentInset.top + self.contentInset.bottom > self.bounds.size.height) { // Can scroll vertically. scrollableDirection |= ASScrollDirectionVerticalDirections; } return scrollableDirection;