Trying to put a Text Path on a Text element in SVGJS, but I want to use an existing Path instead of SVGJS creating an additional Path element in the defs section that I have to update.
The reason for this is that I have a (text) label that appears on a line, which can be dragged around, and I would like to be able to have the native SVG do this, rather than also having to update the text path on the element as well.
So currently SVG.JS will do this
<defs>
<path id="SvgjsPath0010" d="M0,0L100,100" />
</defs>
....
<g>
<path id="SvgjsPath1234 d="M0,0L100,100" />
<text>
<textPath id="SvgjsTextPath0011" href="#SvgjsPath0010">
A Label
</textPath>
</text>
</g>
What I want to achieve is to do this in SVG.JS is simply use the path element above as the TextPath...
<g>
<path id="SvgjsPath1234 d="M0,0L100,100" />
<text>
<textPath id="SvgjsTextPath0011" href="#SvgjsPath1234">
A Label
</textPath>
</text>
</g>
I've tried to pass the Path object, but no-go, and the documentation is a bit flimsy on this one. I've tried this already;
var path = mySvgGroup.path('M0,0L100,100');
var line = mySvgGroup.text('A Label');
line.path( path );
But doesn't seem to like it.
My best option at the moment I think is to build the Text element manually, but would prefer a quicker, cleaner option.
Any suggestions?