-
-
Notifications
You must be signed in to change notification settings - Fork 54
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 example code for multiple svg.js instances #26
base: master
Are you sure you want to change the base?
Conversation
Actually this is not the intended way to use this lib. Its more a sideeffect that this is possible. |
@Fuzzyma could you perhaps elaborate a little on your above comment? Assuming you are using svg.js on the server side (using node.js) generating multiple svgs. What would be the preferred approach? |
Atm: None. I just didnt want to make the jump to 0.2 yet because it would be a breaking change. You wouldnt import a window but a window class or factory which you can use to create as much windows as you need. However there is another simple solution as I think about it: const canvas = SVG(document.documentElement)
const svg1 = canvas.nested()
const svg2 = canvas.nested()
// and so on |
The problem I see with your approach is, that you basically create a bunch of detached svgs. So there will be problems with methods which search for |
@lwallent honestly I am not entirely sure. I guess there are the same problems as with regular detached elements on a website. So #document is not in the parent tree and viewportElement might not be set and ownerDocument and so on. As long as it works, it works :D. |
@Fuzzyma I was asking as I was experiencing some strange issues, when I deployed my svgdom based solution on Azure!? From the trenches Oh well, sorry for the detour on this Pull Request :-) |
@lwallent oh wow thats interesting. I hope it wasnt to hard to track it down :D. If you want you can create an issue for the problem which we will close when imagesize was updated. May I ask how you use svgdom? Do you use it together with svg.js? |
@Fuzzyma I will create an issue shortly :-) Yes I use svgdom together with svg.js and svg.filter.js - great work by the way :-) As mentioned in the start of this thread I use it in a setup somewhat comparable to the one described in this pull request - potentially serving up enormous amounts of svgs from the same svgdom through a rest based web API. |
No description provided.