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
541 stars 83 forks source link

Zoom in/ out implementation #111

Closed agporto closed 1 year ago

agporto commented 1 year ago

@andfanilo Thanks for this great library. I was trying to implement zoom in/out of the canvas and I got it to work great on canvas objects (see file attached). For some reason, however, the background image does not respond to mouse events. Any chance you might know what is causing it? DrawableCanvas_mod.txt

andfanilo commented 1 year ago

Hello @agporto ,

Are you able to make a PR, just to make it easier for me to view the code changes? We can close it afterwards if you then want to do a proper one.

Judging from https://stackoverflow.com/questions/16980273/html-5-how-to-zoom-canvas-background-image, It might be you need to redraw a scaled version of the image on the background canvas, though I didn't dig further

Anyway that looks awesome, hope it works out for you!

Have a nice day, Fanilo

agporto commented 1 year ago

Closing for now, since I submitted the PR. #112