2
我想要使用JavaScript來確定現有SVG線段(屏幕像素)的長度,斜率和其他測量值。我一直在嘗試使用jquery-svg插件,但沒有任何運氣。有什麼建議麼?確定SVG線段的長度,斜率和其他測量
我想要使用JavaScript來確定現有SVG線段(屏幕像素)的長度,斜率和其他測量值。我一直在嘗試使用jquery-svg插件,但沒有任何運氣。有什麼建議麼?確定SVG線段的長度,斜率和其他測量
隨着越來越多的搜索,我發現了一些JavaScript方法應該做的工作:
document.getElementById("segment-line-c2200").getTotalLength()
回報205.11094665527344
個document.getElementById("segment-line-c2200").getBBox()
回報
SVGRect
height: 32.8560791015625
width: 202.4622802734375
x: 1617.7255859375
y: 2013.96435546875
__proto__: SVGRect