Raphaeljs:访问封闭路径上点击的相对位置 [英] Raphaeljs: accessing the relative postion of a click on a closed path
本文介绍了Raphaeljs:访问封闭路径上点击的相对位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用出色的raphaeljs库,并在创建路径后使用
i'm using the excellent raphaeljs library and after having created a path with
var c = paper.path("M10 10L90 90 ..... z");
我想获取click事件在相对于画布的路径上的位置.我试过了:
i would like to get the position of the click event on the path relative to the canvas. I tried:
c.click(function (event) {
alert(event.pageX);
}));
但这给了我一个与拉斐尔的画布无关的价值.任何的想法?
but that gives me a value which is not relative to raphael's canvas. Any idea? thx
推荐答案
类似
var x = Math.floor((event.pageX-$("#paper").offset().left));
很明显,这是使用jQuerys $获取纸质元素.
Obviously this is using jQuerys $ to get the paper element..
这篇关于Raphaeljs:访问封闭路径上点击的相对位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文