andfanilo / streamlit-drawable-canvas

Do you like Quick, Draw? Well what if you could train/predict doodles drawn inside Streamlit? Also draws lines, circles and boxes over background images for annotation.
https://drawable-canvas.streamlit.app/
MIT License
563 stars 85 forks source link

fix first delete update not in sync #34

Closed amantik closed 3 years ago

amantik commented 3 years ago

when deleting an object using the transform tool, the update is 1 step behind because the click event (and the update state) happens before the double click event fires. The current suggestion is just to save the state after the double click event.

andfanilo commented 3 years ago

Hello @amantik!

Thanks a lot for catching that (really, the lack of unit testing over canvas makes some bugs difficult to track -.-...) and providing a fix, truly appreciated!

Some minor suggestions then I'll merge and release the fix ;) :

Cheers, Fanilo

amantik commented 3 years ago

Hi @andfanilo. Thanks for building out the project. I'm not an expert in react, so my fix is just a suggestion. I updated and rebase against develop to not overwrite existing changes in develop. Please check if the unsubscription code is as you requested.

andfanilo commented 3 years ago

@amantik tested locally, this is awesome :) thanks for the fix, will redeploy a new version

I'm not an expert in react, so my fix is just a suggestion.

I'm only 6 months into React, doing it like 3 hours every 2 weeks so I'm no expert either :)