Skip to content

Commit

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

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

0 comments on commit d878787

Please sign in to comment.