From 8986ca9dec7e28118aec41f0d597fdb76c58cc77 Mon Sep 17 00:00:00 2001 From: Steven Petryk Date: Fri, 30 Dec 2022 22:31:53 -0800 Subject: [PATCH] Improve logic in MovablePoint to prevent sticking --- src/interaction/MovablePoint.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interaction/MovablePoint.tsx b/src/interaction/MovablePoint.tsx index 2b77c526..c4e2fa76 100644 --- a/src/interaction/MovablePoint.tsx +++ b/src/interaction/MovablePoint.tsx @@ -45,9 +45,9 @@ export const MovablePoint: React.VFC = ({ const pickup = React.useRef([0, 0]) - const bind = useDrag(({ event, down, movement: pixelMovement, first }) => { + const bind = useDrag(({ event, last, movement: pixelMovement, first }) => { event?.stopPropagation() - setDragging(down) + setDragging(!last) if (first) pickup.current = vec.transform(point, transform) if (vec.mag(pixelMovement) === 0) return