Skip to content

Commit

Permalink
Fix for Trim Path Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon_withrow committed Nov 1, 2017
1 parent c5f9f5b commit e4217a6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lottie-ios/Classes/Extensions/LOTBezierPath.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ - (void)LOT_appendPath:(LOTBezierPath *)bezierPath {
}

- (void)trimPathFromT:(CGFloat)fromT toT:(CGFloat)toT offset:(CGFloat)offset {
fromT = MIN(MAX(0, fromT), 1);
toT = MIN(MAX(0, toT), 1);
if (fromT > toT) {
CGFloat to = fromT;
fromT = toT;
Expand Down Expand Up @@ -395,6 +397,13 @@ - (void)trimPathFromT:(CGFloat)fromT toT:(CGFloat)toT offset:(CGFloat)offset {
} else {
currentStartLength = fromLength;
currentEndLength = totalLength;
if (fromLength < (subpathBeginningLength + pathLength) &&
fromLength > subpathBeginningLength &&
currentSpanEndT < 1) {
// Loop over this subpath one more time.
// In this case the path start and end trim fall within this subpath bounds
continue;
}
}
}
}
Expand Down

0 comments on commit e4217a6

Please sign in to comment.