powerboy
powerboy

Reputation: 10961

Is there a command to move the whole SVG path to a new position?

Is there a command to move the whole SVG path to a new position, instead of adding the offsets to each point of the path?

Upvotes: 18

Views: 15723

Answers (2)

laurent lahmy
laurent lahmy

Reputation: 1689

<path transform="translate(x, y)" d="....">

If your path already has transforms and you'd rather not interfere with them:

<g transform="translate(x, y)">
    <path transform="..." d="....">
</g>

Stealing from Phrogz's comment and Powerboy's answer.

Upvotes: 6

powerboy
powerboy

Reputation: 10961

Thanks to sehe's comment. The solution is: wrap the path into

<g transform="translate(offset_x,offset_y)"></g>

Upvotes: 38

Related Questions