如何计算SVG对象旋转和缩放后的坐标?

Bab*_*abu 5 css svg coordinates coordinate-systems

我想知道 SVG 对象旋转和缩放后的坐标(即,如果起始 x、y 坐标和高度、宽度已知,则结束 x 和 y 坐标)。

有没有办法计算旋转后 SVG 对象的结束坐标?

如果有人知道请帮我解决这个问题。

nit*_*ngh 1

BBox 方法有助于在应用形状或对象之后或之前获取起点和终点。

You can select the object using d3 or jquery
        if you are using d3 the select in this way 
                    var rect = d3.select(selecteObject);
        if jquery then 
                   var rect = $(selecteObject);
                   var newx = rect.node().getBBox().x;
                   var newy = rect.node().getBBox().y;
                   var neww = rect.node().getBBox().width;
                   var newh = rect.node().getBBox().height;
                   var endCodinatex = newx + neww;
                   var endCodinatY = newy + newh;
Run Code Online (Sandbox Code Playgroud)