Skip to content

Commit

Permalink
Remove rounding from setMaxFrame (#2064)
Browse files Browse the repository at this point in the history
Fixes #2042
Fixes #2044
  • Loading branch information
gpeal committed Apr 23, 2022
1 parent 47745aa commit b2f2161
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
Expand Up @@ -691,7 +691,7 @@ public void setMaxProgress(@FloatRange(from = 0f, to = 1f) final float maxProgre
lazyCompositionTasks.add(c -> setMaxProgress(maxProgress));
return;
}
setMaxFrame((int) MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), maxProgress));
animator.setMaxFrame(MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), maxProgress));
}

/**
Expand Down
Expand Up @@ -138,8 +138,8 @@ public void setComposition(LottieComposition composition) {

if (keepMinAndMaxFrames) {
setMinAndMaxFrames(
(int) Math.max(this.minFrame, composition.getStartFrame()),
(int) Math.min(this.maxFrame, composition.getEndFrame())
Math.max(this.minFrame, composition.getStartFrame()),
Math.min(this.maxFrame, composition.getEndFrame())
);
} else {
setMinAndMaxFrames((int) composition.getStartFrame(), (int) composition.getEndFrame());
Expand Down
Expand Up @@ -67,7 +67,7 @@ public void testMaxFrame() {
LottieDrawable drawable = new LottieDrawable();
drawable.setComposition(composition);
drawable.setMaxProgress(0.25f);
assertEquals(121.99f, drawable.getMaxFrame());
assertEquals(121f, drawable.getMaxFrame());
}

@Test
Expand Down

0 comments on commit b2f2161

Please sign in to comment.