terrylinla / react-native-sketch-canvas

A React Native component for drawing by touching on both iOS and Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to detect if the touch is from apple pencil or hand?

PankajPunia opened this issue · comments

I'm using this library in an iPad app for making notes. When user is using an apple pencil to draw on canvas, i want to draw only with pencil touch not with any other gesture , for example , sometimes, i see unexpected lines and dots because of the palm resting on iPad screen.

Is there a way to handle this case? Is it possible to detect if the touch is from pencil or palm?

@terrylinla @diego-caceres @jeanregisser @artdevgame @toblerpwn

I kind of resolved it using another approach that helps in avoiding multiple touches. I updated the code in SketchCanvas.js file as follows :

Replaced if (!this.props.touchEnabled) return with if (!this.props.touchEnabled || gestureState.numberActiveTouches > 1) return in onPanResponderGrant, onPanResponderMove and onPanResponderRelease functions