1

I have a svg map that have many path elements that all look similar. I want to get their x axis, y axis and angle (transform / rotation / degrees) positions for other manipulations.

Using getBBox i can able to get x axis and y axis. but i want to get the rotation angle of the path element (i.e., something like 180 degree, 320 degree etc..). Is there any way i can get the path elements angle.

please check the fiddle below in which i can retrieve x axis and y axis but not angle.

http://jsfiddle.net/YKMwf/

$(document).ready(function () {
    var bb = $('#svg_3').get(0).getBBox();
     $("#divaxis1").html("x = " + bb.x + "  y = " + bb.y);

    bb = $('#svg_2').get(0).getBBox();
     $("#divaxis2").html("x = " + bb.x + "  y = " + bb.y);
});
4

1 回答 1

0

如果您需要跟踪和更改元素的旋转 - 最好在 CSS 中完成。然后,您可以继续跟踪角度位置。

http://css-tricks.com/get-value-of-css-rotation-through-javascript/

于 2013-06-20T12:03:44.043 回答