Program-AR / blockly-to-svg

Export any blockly workspace to SVG
MIT License
11 stars 7 forks source link

PNG and Null error #2

Open JoshuaLowe1002 opened 4 years ago

JoshuaLowe1002 commented 4 years ago

@51lv3str1

Great work!!

I'm wondering if you have an example where it gets exported to PNG rather than SVG?

Also on my beta.app.edublocks.org for some reason Blockly.Css.CONTENT is null :(

asanzo commented 4 years ago

¡Hi Joshua!

Regarding to PNG export, I've just added that to this script. In the bottom of the script you can choose if to exportSVG() or exportPNG() (uncomment the line you want to use)

Regarding to Blockly.Css.CONTENT, I've just run this script (blockly-to-svg) in your page beta.app.edublocks.com (great page, by the way) and it exports the SVG fine. That variable is not null.

Can you tell us more about your problem?

JoshuaLowe1002 commented 4 years ago

Thanks so much for this. Amazing work. I’ll try it out later today.

Yes, that bug is now fixed. There was a line I had to comment out on blockly. In newer versions the css contents in that function get wiped

JoshuaLowe1002 commented 4 years ago

Great work @asanzo I have tried it today but have a few questions. It seems to limit the size here and cut things off, do you know why? One last question is, how do I get the dropdown arrows to show on the final image? Thanks once again! image

asanzo commented 4 years ago

Hi, again Joshua!! In the script, you have to tweak canvas size:

Where it says:

var canvas = document.createElement('canvas');

you can add:

var canvas = document.createElement('canvas');
canvas.width = 800;
canvas.height = 600;

So you can choose canvas size. I have added that to the code.

Regarding to the dropdown arrows, sorry but I don't have a clue why in that page they don't show.

I've opened an issue to deal with it: https://github.com/Program-AR/blockly-to-svg/issues/3

We don't know when we'll be able to correct it as we have lots of work :)

If you're ok with it, we can close this issue.