Javascript Raphael.js如何找到点击路径';她中风了?
如何使用Raphael.js(当用户单击SVG路径时)发现单击是在笔划上 以下是路径:Javascript Raphael.js如何找到点击路径';她中风了?,javascript,svg,click,raphael,Javascript,Svg,Click,Raphael,如何使用Raphael.js(当用户单击SVG路径时)发现单击是在笔划上 以下是路径: var polycoords = [['M',10,10],['L',30,10],['L',35,50],['L',5,45],['Z]]; var poly = paper.path(polycoords).attr({'stroke':'#00f','stroke-width':5}); poly.click(function(e) { // I think here can I find it
var polycoords = [['M',10,10],['L',30,10],['L',35,50],['L',5,45],['Z]];
var poly = paper.path(polycoords).attr({'stroke':'#00f','stroke-width':5});
poly.click(function(e) {
// I think here can I find it somehow...
});
就你的路径而言,它是封闭的,但没有填充颜色或图案,只有笔划是可点击的,所以问题似乎自行解决了 如果在一些未粘贴的代码行中,您实际上填充了此路径,那么内部也是可单击的,并且提供给单击回调的事件参数没有区别 两种方式:
Raphael.pathIntersection(path1,path2)
()搜索与现有路径的交点