Closed saadfaisal closed 9 years ago
well it seems that the reason was that for FireFox , the svg node needs to be part of any existing DOM node, so adding this resolve the issue.
function CreateSVGPreviewNode() {
var svg_clone = null;
var spec = getPathNode();
var style_str = "<svg id=\"svg"+GetNextTime()+"\""
+"xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"430\" height=\"430\""
+"xmlns:xlink=\"http://www.w3.org/1999/xlink\""
+"xmlns:svg=\"http://www.w3.org/2000/svg\""
+"xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\""
+"xmlns:cc=\"http://creativecommons.org/ns#\""
+"xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"
+"<path d=\""+ spec.svgData +"\" style=\"fill:#ffff00\" id=\"path-"+GetNextTime()+"\"></path>"
+"</svg>";
svg_clone = $.parseHTML(style_str)[0];
var root = document.getElementById("svgContainerForRunTimeNodes");
root.appendChild(svg_clone);
return svg_clone;
}
"svgContainerForRunTimeNodes" is just a div in this case. Case Closed.
Yes, unfortunately it is an error in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=756985
I corrected the code, and check for null return value, so in the next JSModeler release it will work. I'm glad you found a workaround, and thanks for the error report.
Hi , i am generating SVG nodes at runtime with stored path elements from database and generate 3D Models on the fly. This works perfectly fine with Chrome however FireFox is causing issues. Here is how i generate an SVG node, assume
However when i attempt to create a Model out of this node, the SVGToModel function crashes exactly on the following line in function "AddTransformedVertex"
its the getCTM() that returns the null and crashes the code. Any suggestion if there are any consistent ways that i can use to generate such runtime nodes and makes model out of them.