BenJeau / react-native-draw

SVG based data-driven React Native drawing component 🎨
https://www.npmjs.com/package/@benjeau/react-native-draw
MIT License
131 stars 41 forks source link

Canvas Prop for shouldCancelWhenOutside #64

Open simonrahm opened 2 years ago

simonrahm commented 2 years ago

Is your feature request related to a problem?

First of all, thanks for making this nice library!

I noticed that when your finger moves outside the canvas while drawing, the drawing stops. For some use cases that is quite annoying, especially when the user wants to draw near the edges.

Desired solution (feature)

The Canvas component should have a prop to tell whether the touch should be persisted when moving outside the Canvas or not. Something like:

<Canvas
   color={"#000"}
   thickness={20}
   opacity={1}
   shouldCancelWhenOutside={false}
/>

In Canvas.tsx i noticed a property ".shouldCancelWhenOutside(true)" which is hardcoded to true. Changing this to false seems to solve the problem. Would be nice to have this property controllable via the Canvas prop.

Alternatives considered

No response

Anything else?

No response

BenJeau commented 2 years ago

This should be an easy fix, like you mentioned. Unfortunately I do not have much time to work on this library, but if you can create a PR with the change, I'll happily merge it into the codebase. (or I'll maybe get the time in a couple of months)