I'm trying to import an svg snippet with svg.js and then offset it, but it seems like any transformation method I try to use don't work with imported svg.
The code I have:
var lang = SVG('lang').size(400,400)
var swe = lang.svg('<svg id="swe" width="65" height="40.625" preserveAspectRatio="xMidYMid meet" zoomAndPan="magnify" version="1.0" contentScriptType="text/ecmascript" contentStyleType="text/css" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="navy"/>' +
'<g transform="scale(4.0625)">' +
' <rect x="5" width="2" height="10" fill="gold"/>' +
' <rect y="4" width="16" height="2" fill="gold"/>' +
'</g></svg>')
swe.dx(100).dy(50) <-- this line does nothing.
Nor does any other method that are supposed to translate work, like x()
, transform()
or move()
I have tried making a rectangle and importing into that which also doesn't work:
var flag = lang.rect(65, 40.625)
var swe = flag.svg(<svg code>)
swe.dx(100).dy(50)
I can't find anything in the docs that make me any wiser. Is there anyone who has experience with this?