-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a method to the circuit class, to export circuit SVG as url. #85
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have several concerns with this PR which need to be addressed.
Note that unless jointjs's internal is changed, simply extracting the svg won't work due to the use of style sheets and foreign objects. (The resulting SVG renders differently compared to what was in the browser window). Apparently this is something the paid version supports but not the free version. There was a google group post roughly how to fix those. See https://github.com/yuyichao/digitaljs_code/blob/75a49dd290f7c06a97c3b883133a3905b6e0afec/view/imgutils.mjs for what I needed to do along with other tweaks to achieve a good frame rectangle, minimum svg file size etc. A few aspects are still not very generic (size, style, assumptions on property names etc) but other bits should be reusable. |
Hi @yuyichao thanks for your engagement! I exported SVG via digitaljs_online client. It seems like everything works well for me. I saved the exported SVG in a file and opened it in another browser, and the exported circuit looks good. Do you think / suggest that this is not going to work if I'd use digitaljs without this client? Here is the result of the export (above the simulation in the web client; below the exported SVG file): From above picture looks like all the styles have been preserved. |
No, all the paths are preserved not all the styles. You can see that the content of the input and output boxes are not rendered correctly, the buttons on the subcircuits are shown but shouldn't be there and so is the base selectors for input/output. The input/output are also foreign objects that I don't think works in non-browsers. They show up as black boxes for me in some viewers IIRC. (The font is also different but I'm not an expert on that...) |
Okay I see the problem now. Removing base selectors and subcircuits buttons seems to be pretty easy. But replacing inputs and rendering them in a correct place is going to be more challenging. Anyway – thank you for your input. I am going to work more on that and fix the mentioned issues. |
No description provided.