Raphael.js convert text to path

我怕爱的太早我们不能终老 提交于 2019-12-11 01:34:18

问题


I've setup a drawing utility with Raphael.js. The user can draw shapes, paths and enter text. Once a user adds text -> Paper.text() to the svg the svg goes into a selectable state. Meaning, if I add text and switch to the pen tool, moving the pen around the svg will cause adjacent dom elements to go into their ::selection state.

So I'd like to convert the text to a path to prevent this from happening. I don't see anything like this in the documentation.


回答1:


if you use print() instead of text() for text printing, then the text will be a raphael path object. (print() use a cufon javascript font that renders to a raphael path).




回答2:


Try tweaking the pointer-events property on the text elements with .attr(). none might fit your needs. There are some good background info links on MDN.

.attr({pointer-events: none})


来源:https://stackoverflow.com/questions/9702976/raphael-js-convert-text-to-path

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