0.2.1 • Published 3 years ago

react-multitouch-gestures v0.2.1

Weekly downloads
-
License
-
Repository
github
Last release
3 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

3 years ago

0.2.0

3 years ago

0.1.27-s

3 years ago

0.1.26-s

3 years ago

0.1.25

3 years ago

0.1.24

3 years ago

0.1.23

3 years ago

0.1.22

3 years ago

0.1.21

3 years ago

0.1.20

3 years ago

0.1.19

3 years ago

0.1.18

3 years ago

0.1.17

3 years ago

0.1.16

3 years ago

0.1.15

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago