Search code examples
javascriptsvgjquery-svg

Calculating the length of a subpath using the SVG specification


I am an amateur on coding, trying to learn Javascript. Pardon me if I sound too generic. I'll try my best not to.

I am working on SVG-edit and I am trying to get the length of a subpath(the path that is being drawn after i create a node on my ''superpath'') . I know i can get the total length of the ''superpath'' with the get.totalpathlength method.

Is their a method that does that or do I need to construct a formula from scratch using the totalpathlength and mouseclick detections?


Solution

  • If you want to know the length of the last segment, measure the whole path then measure an invisible copy of the path without the last segment and subtract.