fabricerin
fabricerin copied to clipboard
Export in fabric_drawing()
There's an export button connected to the canvas produced by fabric_drawing()
, and I can see in the source code that the click method invokes saveAs()
. But I don't know how to get saveAs()
to save the blob, or if it is saving it, where that is. I'm not a JavaScript programmer, which is precisely why tools like this are so helpful. I've looked through various forums about saveAs()
, some suggesting that one needs to implement the function in the document (which I've tried, creating a stub that indeed gets called when clicking "export." Others suggest that saveAs()
is built-in to the browser, but you need to set certain permissions to use it.
I wonder if you might include an example in the package that allows drawings to be saved or copied to the clipboard or a Shiny object or whatever. This would be extremely helpful in the application I'm developing for letting statistics and math students draw on top of graphs and hand in their work.
Hi, @dtkaplan for now there is only one method for saving the drawing which the export button that saves the canvas as a PNG image. What do you mean exactly by the blob
? for fabric_drawing( )
, the blob is "the canvas" or the image that will be rendered from the canvas.
You can find here some examples concerning the export button https://ihaddadenfodil.com/post/fabricerin-a-tutorial/
Thanks for your quick response. And for your tolerance of my asking a beginner’s question.
Your system works perfectly when I compile it into an html_document or any other format with the default runtime. I should have tried this first.
My particular interest is to include drawing in {shiny} or {learnr} apps. For instance, I’m developing a large set of tutorials for a calculus course—-here’s an example https://maa-statprep.shinyapps.io/142Z-DD-07/#section-graphing-anti-derivatives—-where students can hand-in their work. It would be great to be able to provide students with exercises where, for instance, they annotate a graphic. I need somehow to grab the blog and transfer it to a shiny object.
I suppose that the path I should follow is to find out how to build shiny widgets. Thanks for your contributions to the R community and for your help to me.
On Fri, Jan 29, 2021 at 5:36 PM Ihaddaden Mohamed El Fodil < [email protected]> wrote:
You can find here some examples concerning the export button https://ihaddadenfodil.com/post/fabricerin-a-tutorial/
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/feddelegrand7/fabricerin/issues/11#issuecomment-770105431, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECBLM6DIFI5LF75WHZJZDS4NA57ANCNFSM4WZV2M7A .
Hi, thanks @dtkaplan I find the idea interesting, add an additional layer to a shiny output so that one (for example) can draw on it, unfortunately, at the moment I don't have the skills required to create this feature as it's quite complex. Will think about it tough, thanks again.