Does path.getTotalLength no longer work anymore for text svg?

自古美人都是妖i 提交于 2020-07-23 17:22:25

问题


I'm trying to get the path length for the stroke of a SVG text element and I'm getting a "path.getTotalLength is not a function" error in my console. When I look up getTotalLength, I see that it's been depreciated? It looks like it has something to do with the shift from SVG1 to SVG2? Is this correct?


回答1:


It has not been deprecated. In SVG 1.1, getTotalLength() is only available on the <path> element.

In SVG 2, which browsers are still in the process of implementing (so you can't rely on it yet), getTotalLength() is available on all shape elements, but not including text elements.



来源:https://stackoverflow.com/questions/43198953/does-path-gettotallength-no-longer-work-anymore-for-text-svg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!