[英]Get absolute position of a SVG element
Suppose this snippet code with svg.js
假设这个代码片段带有
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
? 现在,我怎么能得到这个
rect
的绝对位置?
Thanks for any help 谢谢你的帮助
You can use the rbox
function, which takes the translations into account. 您可以使用
rbox
功能,它将翻译考虑在内。
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());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.