react-use-draggable-scroll
react-use-draggable-scroll copied to clipboard
Accept more than one mouse button
Hey!
Thanks for the library, it's really performant.
I needed a small change for my project so it could get more than one button instead of only left, middle or right. It's pretty useful for tables and things like that.
It's possible to do it like this too but it seems less readable in my opinion :/
const getIsMousePressActive = (buttonsCode: number) => {
return (
((activeMouseButton === "Left" || activeMouseButton.includes("Left")) &&
buttonsCode === 1) ||
((activeMouseButton === "Middle" ||
activeMouseButton.includes("Middle")) &&
buttonsCode === 4) ||
activeMouseButton === "Right" ||
(activeMouseButton.includes("Right") && buttonsCode === 2)
);
};
Hi @adrianhm13,
Many thanks for your support! I'm happy to know that you liked.
Before merging your PR, may I ask you to add a short explanation in the README file on how to use this feature? Could you please do that?
Dear @adrianhm13,
Due to the inactivity of this PR and also the fact that the branch has conflicts, I will close this request. Please, feel free to submit a PR you see fit as all collaborations are highly appreciated.
All the best