Skip to content

Commit

Permalink
neater
Browse files Browse the repository at this point in the history
  • Loading branch information
George Harker committed Apr 3, 2015
1 parent f2e6450 commit f6653bd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/pagingscrollview/src/NIPagingScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,12 @@ - (NSInteger)pageIndexForOffset:(CGFloat)offset {
if (NIPagingScrollViewHorizontal == self.type) {
// Whatever image is currently displayed in the center of the screen is the currently
// visible image.
return NIBoundi((NSInteger)(NICGFloatFloor((offset + boundsSize.width / 2) /
boundsSize.width)
return NIBoundi((NSInteger)(NICGFloatFloor((offset + boundsSize.width / 2) / boundsSize.width)
+ 0.5f),
0, self.numberOfPages - 1);

} else if (NIPagingScrollViewVertical == self.type) {
return NIBoundi((NSInteger)(NICGFloatFloor((offset + boundsSize.height / 2) /
boundsSize.height)
return NIBoundi((NSInteger)(NICGFloatFloor((offset + boundsSize.height / 2) / boundsSize.height)
+ 0.5f),
0, self.numberOfPages - 1);
}
Expand Down

0 comments on commit f6653bd

Please sign in to comment.