embiem / react-canvas-draw

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

Event listener to detect drawing on canvas #118

Open Arp-G opened 3 years ago

Arp-G commented 3 years ago

Firstly, thanks for this awesome library.

Currently, we have an onChange listener to detect changes on the canvas but it only gets invoked on mouse up, there are use cases where we need an event listener that gets executed whenever anything is drawn on canvas even without mouse up.

For example, I have a use case where I need to get the canvas data every time something is drawn on the canvas, the event listener should fire whenever a stroke is made on the canvas and should not wait for the mouse up.

If anyone has any idea or can guide me to something like this it would be very helpful, I could also open a PR if needed

jaxomlotus commented 2 years ago

Echoing strong interest in this. If there's an alternative branch with this feature I'd be interested. What I'd like is a call back to get the x,y position of the cursor on every pixel change.