Estoy usando la biblioteca SVG.js en mi proyecto y estoy tratando de mover un grupo que contiene algo de rect , text y un elemento de use en la dirección x:
// create symbol, symbol can be anything const symbol = svg.symbol().circle(10) //create group with elements const group = svg.group(); const rect = group.rect(); const text = group.plain('some text'); const symbolUse = svg.use(symbol); group.add(symbolUse); //some time later...move group to new x coordinate (can be anything) group.x(newX)Ahora funciona completamente bien con todos los elementos de texto y rect. Se mueven exactamente como yo quiero que se muevan en la dirección x. Pero el elemento de uso de alguna manera se mueve en la dirección x E y, lo que definitivamente no debería hacer.


Ahora, ¿es esto un error de la biblioteca SVG.js o me estoy perdiendo algo con respecto al elemento de uso?
Lo que quieres es la función transform() .
Ver: https://svgjs.dev/docs/3.0/manipulating/#transforming
var svg = SVG().addTo('body').size(300, 300) const symbol = svg.symbol().circle(10) //create group with elements const group = svg.group(); const rect = group.rect(); const text = group.plain('some text'); const symbolUse = svg.use(symbol); group.add(symbolUse); // Move the whole group right by 150 units group.transform({translateX: 150}); <script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js@3.0/dist/svg.min.js"></script>