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
585 stars 91 forks source link

rect drawing mode not working on mobile phone #105

Open HrsPythonix opened 1 year ago

HrsPythonix commented 1 year ago

I tried the streamlit-drawable-canvas in https://drawable-canvas.streamlit.app/ on my mobile, but it only respond when under freedraw mode, the others were not working, any idea how to fix it?

andfanilo commented 1 year ago

Hey @HrsPythonix Ah, I don't think the code works with mobile events, the underlying code uses a non-responsive library :/ lemme see

HrsPythonix commented 1 year ago

Hey @HrsPythonix Ah, I don't think the code works with mobile events, the underlying code uses a non-responsive library :/ lemme see

@andfanilo I had aglance at your code, I find that you implement the rect drawing using mouse event (like mouse:down, mouse:move), I test my phone on http://fabricjs.com/events and it can trigger these event.

HrsPythonix commented 1 year ago

@andfanilo https://github.com/andfanilo/streamlit-drawable-canvas/pull/106 I add this line to fix this problem in rect mode, I think this can also apply to other event-based drawing mode, but I haven't modify them. Maybe you can check and see if there are potential bugs

andfanilo commented 1 year ago

Hello! Sorry I have seen the PR but had not have time to test it with all the components. I'll give you a sign when I do, or if you do it let me know! Thanks for the PR :)