Skip to content

Commit

Permalink
fix: touch devices - allow pointer to leave container and continue dr…
Browse files Browse the repository at this point in the history
…agging while pointer is down
  • Loading branch information
nerdyman committed Jan 4, 2020
1 parent c5d6dfd commit 9488766
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/react-compare-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,18 @@ export const ReactCompareSlider: React.FC<ReactCompareSliderProps &
window.addEventListener('mousemove', handlePointerMove, {
passive: true,
});

window.addEventListener('mouseup', handlePointerUp, {
passive: true,
});

window.addEventListener('touchmove', handlePointerMove, {
passive: true,
});

window.addEventListener('touchend', handlePointerUp, {
passive: true,
});
hasWindowBinding.current = true;
}

Expand Down

0 comments on commit 9488766

Please sign in to comment.