Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(cropper): reset animation state on no-op and pending frames

Richie McIlroycd935e54fdcf
diff --git a/apps/desktop/src/components/Cropper.tsx b/apps/desktop/src/components/Cropper.tsx
index 2a22e1b5f..f182f1e6b 100644
--- a/apps/desktop/src/components/Cropper.tsx
+++ b/apps/desktop/src/components/Cropper.tsx
@@ -436,6 +436,9 @@ export function Cropper(
target.width === start.width &&
target.height === start.height
) {
+ animationFrameId = null;
+ setIsAnimating(false);
+ setDisplayRawBounds(target);
return;
}
@@ -470,6 +473,7 @@ export function Cropper(
durationMs = 240,
) {
if (animationFrameId !== null) cancelAnimationFrame(animationFrameId);
+ animationFrameId = null;
setIsAnimating(true);
setRawBoundsConstraining(bounds, origin);
animateToRawBounds(rawBounds(), durationMs);