Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(cropper): use pointer capture for overlay resize session

Richie McIlroy9c204e5c6874
diff --git a/apps/desktop/src/components/Cropper.tsx b/apps/desktop/src/components/Cropper.tsx
index 18f5639a3..a363ac08f 100644
--- a/apps/desktop/src/components/Cropper.tsx
+++ b/apps/desktop/src/components/Cropper.tsx
@@ -918,20 +918,19 @@ export function Cropper(
originalHandle: handle,
};
- createRoot((dispose) => {
- createEventListenerMap(window, {
- pointerup: () => {
- setMouseState({ drag: null });
- const bounds = rawBounds();
- if (bounds.width < 5 || bounds.height < 5) {
- setRawBounds(initialBounds);
- if (!isAnimating()) setDisplayRawBounds(initialBounds);
- }
- dispose();
- },
- pointermove: (e) => handleResizePointerMove(e, context),
- });
- });
+ trackPointerSession(
+ target,
+ e.pointerId,
+ (e) => handleResizePointerMove(e, context),
+ () => {
+ setMouseState({ drag: null });
+ const bounds = rawBounds();
+ if (bounds.width < 5 || bounds.height < 5) {
+ setRawBounds(initialBounds);
+ if (!isAnimating()) setDisplayRawBounds(initialBounds);
+ }
+ },
+ );
}
const KEY_MAPPINGS = new Map([