frogatto
frogatto

Reputation: 29285

Get absolute position of a SVG element

Suppose this snippet code with svg.js

var g1 = draw.group();
var g2 = g1.group();
g2.move(100,100);
var g3 = g2.group();
g3.rect(200,200);

Now, how i can get the absolute position of this rect?
Thanks for any help

Upvotes: 3

Views: 4556

Answers (1)

Nils
Nils

Reputation: 2061

You can use the rbox function, which takes the translations into account.

Here is an example:

var draw = SVG('paper');
var g1 = draw.group();
var g2 = g1.group();
g2.move(100,100);
var g3 = g2.group();
var rect = g3.rect(200,200);

console.log(rect.rbox());

Upvotes: 2

Related Questions