Fixed issue where scrollPercentage would never be equal to 1.0 when scrollDirection was XLPagerTabStripDirectionLeft or XLPagerTabStripDirectionNone due to inaccuracies in the floating point modulo operation
This commit is contained in:
parent
e9fbbb9b25
commit
3e2a46a5fd
|
|
@ -266,6 +266,9 @@
|
|||
-(CGFloat)scrollPercentage
|
||||
{
|
||||
if ([self scrollDirection] == XLPagerTabStripDirectionLeft || [self scrollDirection] == XLPagerTabStripDirectionNone){
|
||||
if (fmodf(self.containerView.contentOffset.x, [self pageWidth]) == 0.0) {
|
||||
return 1.0;
|
||||
}
|
||||
return fmodf(self.containerView.contentOffset.x, [self pageWidth]) / [self pageWidth];
|
||||
}
|
||||
return 1 - fmodf(self.containerView.contentOffset.x >= 0 ? self.containerView.contentOffset.x : [self pageWidth] + self.containerView.contentOffset.x, [self pageWidth]) / [self pageWidth];
|
||||
|
|
|
|||
Loading…
Reference in New Issue