embiem / react-canvas-draw

React Component for drawing in canvas
https://embiem.github.io/react-canvas-draw/
MIT License
892 stars 315 forks source link

Support for pressure considered? #125

Open anilgulecha opened 3 years ago

anilgulecha commented 3 years ago

Pls consider adding pressure based thickness support. Touch events can indicate the pressure on the drawing (which can be used to set the size of point/line/curve drawn).

Eg: https://patrickhlauke.github.io/touch/tracker/tracker-force-pressure.html https://viliusle.github.io/miniPaint/

This would make the component quite versatile.

sifatdipta commented 2 years ago

This honestly would make this program perfect! I actually came here to suggest this.

Would be awesome!

embiem commented 2 years ago

Should be a low-hanging fruit to add using https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure, right?

sifatdipta commented 2 years ago

Should be a low-hanging fruit to add using https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure, right?

Yeah I believe so, you can also look into https://github.com/stuyam/pressure

sifatdipta commented 2 years ago

Would adding a eraser mode be too difficult? I was playing with your codes earlier to come up with a solution for both pressure and eraser mode.