Skip to content

Commit

Permalink
Improve logic in MovablePoint to prevent sticking
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpetryk committed Dec 31, 2022
1 parent a84e9ac commit 8986ca9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/interaction/MovablePoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export const MovablePoint: React.VFC<MovablePointProps> = ({

const pickup = React.useRef<vec.Vector2>([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
Expand Down

1 comment on commit 8986ca9

@vercel
Copy link

@vercel vercel bot commented on 8986ca9 Dec 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.