react-use-draggable-scroll icon indicating copy to clipboard operation
react-use-draggable-scroll copied to clipboard

Accept more than one mouse button

Open adrianhm13 opened this issue 2 years ago • 2 comments

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.

adrianhm13 avatar Jul 08 '22 12:07 adrianhm13

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)
    );
  };

adrianhm13 avatar Jul 08 '22 12:07 adrianhm13

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?

rfmiotto avatar Jul 11 '22 13:07 rfmiotto

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

rfmiotto avatar Jul 12 '23 13:07 rfmiotto