@zohodesk/haptic
v1.0.1
Published
This package contains touch handling functionalities for mobile.
Maintainers
Readme
Haptic
This package contains touch handling functionalities for mobile.
Example Usage For Component
import Touch from "@zohodesk/haptic";
<Touch
handleTouchStart={this.handleTouchStart}
handleTouchMove={this.handleTouchMove}
handleTouchForceChange={this.handleTouchForceChange}
handleTouchEnd={this.handleTouchEnd}
>
{children}
</Touch>Props
children : React Elementrequired (React Element)handleTouchStart(evt, inital) : Functionhandler functionevtwill return touch start eventinital {pageX: 0, pageY: 0, force: 0-1}Position of the event
handleTouchMove(evt,inital,current) : Functionhandler functionevtwill return touch start eventinital {pageX: 0, pageY: 0, force: 0-1}Position of the starting pointcurrent {pageX: 0, pageY: 0, force: 0-1}Current Position of the touch point
handleTouchForceChange(force) : Functionhandler functionforce - (0-1)Position of the event
handleTouchEnd(evt, current) : Functionhandler functionevtwill return touch start eventcurrent {pageX: 0, pageY: 0, force: 0-1}Current Position of the touch point
handleSwipeLeft(inital, current) : Functionhandler functioninital {pageX: 0, pageY: 0, force: 0-1}Position of the starting pointcurrent {pageX: 0, pageY: 0, force: 0-1}Current Position of the touch point
handleSwipeRight(inital, current) : Functionhandler functioninital {pageX: 0, pageY: 0, force: 0-1}Position of the starting pointcurrent {pageX: 0, pageY: 0, force: 0-1}Current Position of the touch point
handleSwipeUp(inital, current) : Functionhandler functioninital {pageX: 0, pageY: 0, force: 0-1}Position of the starting pointcurrent {pageX: 0, pageY: 0, force: 0-1}Current Position of the touch point
handleSwipeDown(inital, current) : Functionhandler functioninital {pageX: 0, pageY: 0, force: 0-1}Position of the starting pointcurrent {pageX: 0, pageY: 0, force: 0-1}Current Position of the touch point
config : Objecttravelled distance in pixel. default 50.swipeDistance : Numbertravelled distance in pixel. default 50.longPressDuration : NumberThis will be usefull whenontouchforcechangeis not supported browsers. default 50.preventClickTime : NumberTo prevent click event time in millis. default 500.preventClickMaxForce : NumberTo prevent click event by max force. default 0.5preventDefault : boolean
1.0.0 , 1.0.1
Touchcomponent anduseSwipehook published
