0.2.1 • Published 2 years ago

react-multitouch-gestures v0.2.1

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

react-multitouch-gestures

this is an react gesture library that supports:

  • tap
  • hold
  • rotate
  • pinch
  • drag with one finger
  • drag with two fingers
  • drag with three fingers

demo

How to use

function App() {
    const component = useRef(null)


    const onDrag = (pointer: IPointer) => {
        console.log("dragging")
    }

    useGestures(component, {
    onTapGesture: (pointer) => console.log(pointer.position.at(0)) //example how to print x position of tap
    onDragGesture: onDrag,
    // onPinchGesture: onPinch,
    // onRotateGesture: onRotate,
    // onDoubleDragGesture: onDoubleDrag,
    // onTripleDragGesture: onTripleDrag,
    // onHoldGesture: onHold
  },
    8, //distanceTreshold for hold gesture, the bigger number the further you can drag while holding
    1000 // time in ms when the hold activates
  )

  return (
    <div className="App"
      ref={component}
      style={{ touchAction: 'none' }} //you need to disable default browser gestures
    >
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          react-multitouch-gestures
        </p>
      </header>
    </div>
  );
}

how to run this repository

"clone this repository"
"uncomment lines in tsconfig.json"
npm i
npm run start
0.2.1

2 years ago

0.2.0

2 years ago

0.1.27-s

2 years ago

0.1.26-s

2 years ago

0.1.25

2 years ago

0.1.24

2 years ago

0.1.23

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago