akshay2211 / DrawBox

DrawBox is a multi-purpose tool to draw anything on canvas, written completely on jetpack compose.
https://ak1.io/DrawBox/
Apache License 2.0
296 stars 40 forks source link

Finish drawing callback #44

Open MarkYav opened 1 year ago

MarkYav commented 1 year ago

The feature request Please, can you add a callback when a user finishes drawing a line/curve?

The description of the solution I'd like To my mind, it will be useful to have a drawing callback when a user finishes drawing a line and put away his/her finger from the screen. We have the trackHistory() callback for the moment when a user starts drawing, but there is no such thing when the user finishes drawing a line.

Alternatives I've considered It is possible to use some click listener on top of the DrawBox, but this looks more like a hotfix and it is hard to understand for other people. Also, I was trying to use trackBitmaps(...) to get the bitmap after each drawing, but it is not working as intended. Maybe it is also possible to make this function open so we can override it as we want.

Usage context I need this callback to execute a function with the latest bitmap data. The thing is that I want to execute it every time a user draws a line.