Reputation: 8054
I'd like to use JavaScript to determine the length, slope, and other measurements of an existing SVG line segment (in screen pixels). I've been trying to use the jquery-svg plugin, but haven't had any luck. Any suggestions?
Upvotes: 3
Views: 1384
Reputation: 8054
With more searching, I found some JavaScript methods that should do the job:
document.getElementById("segment-line-c2200").getTotalLength()
returns 205.11094665527344
document.getElementById("segment-line-c2200").getBBox()
returns
SVGRect
height: 32.8560791015625
width: 202.4622802734375
x: 1617.7255859375
y: 2013.96435546875
__proto__: SVGRect
Upvotes: 2