Skip to content

Commit

Permalink
Merge pull request #31 from giulio92/feature/fix-wrong-targetContentO…
Browse files Browse the repository at this point in the history
…ffset

Fix wrong targetContentOffset return values
  • Loading branch information
Giulio authored Nov 2, 2017
2 parents a2f8155 + a1d9dfd commit 7964dac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Classes/GLCollectionTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
}

override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard proposedContentOffset.x > 0 else {
return CGPoint(x: 0, y: 0)
}

// If the UICollectionView has paginatedScroll set to false there is no
// need to apply any pagination logic, we will return the current
// proposedContentOffset coordinates.
Expand Down Expand Up @@ -112,7 +116,7 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
offsetCorrection = cellLayoutAttribute.frame.origin.x - proposedXCoordWithInsets
}
}

return CGPoint(x: proposedContentOffset.x + offsetCorrection, y: 0)
}
}
Expand Down

0 comments on commit 7964dac

Please sign in to comment.