Skip to content

Commit

Permalink
fix removeEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
sus-yoshikane-t committed Sep 17, 2024
1 parent 02fe81f commit 59f5bb8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hooks/useDrag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ function useDrag(

document.removeEventListener('mouseup', onMouseUp);
document.removeEventListener('mousemove', onMouseMove);
event.currentTarget.removeEventListener('touchend', onMouseUp);
event.currentTarget.removeEventListener('touchmove', onMouseMove);
if (touchEventTargetRef.current) {
touchEventTargetRef.current.removeEventListener('touchmove', mouseMoveEventRef.current);
touchEventTargetRef.current.removeEventListener('touchend', mouseUpEventRef.current);
}
mouseMoveEventRef.current = null;
mouseUpEventRef.current = null;
touchEventTargetRef.current = null;
Expand Down

0 comments on commit 59f5bb8

Please sign in to comment.