| Newsgroups |
gmane.text.xml.svg.devel |
| Message-ID |
<[email protected]> |
Hello,
You should use the SVGTransformable interface (http://www.w3.org/TR/SVG/types.html#InterfaceSVGTransformable http://www.w3.org/TR/SVG/types.html#InterfaceSVGTransformable) with SVGMatrix (http://www.w3.org/TR/SVG/coords.html#InterfaceSVGMatrix http://www.w3.org/TR/SVG/coords.html#InterfaceSVGMatrix).
To create a translate matrix with the root element :
var m = root.createSVGMatrix().translate(dx, dy);
To add it to the transform attribute of a g element :
var l = g.transform.baseVal;
var t = l.createSVGTransformFromMatrix(m);
if (l.numberOfItems != 0) {
l.insertItemBefore(t, 0);
t = l.consolidate();
} else {
t = l.appendItem(t);
}
Or to initialize the transform attribute of a g element :
var l = g.transform.baseVal;
var t = l.createSVGTransformFromMatrix(m);
l.initialize(t);
Try my editor Draw SVG Home http://www.draw-svg.appspot.com/
Draw SVG Home http://www.draw-svg.appspot.com/ The free online SVG drawing application for designers and developpers for creating graphics. Free tool Base64 data:URL image Encoder. Free tool SVG to PNG image Converter
View on www.draw-svg.appspot.com http://www.draw-svg.appspot.com/
Preview by Yahoo
and give me your feedback.
Joseph