开发者

Raphaeljs: accessing the relative postion of a click on a closed path

i'm using the excellent raphaeljs library and after having created a path with

var c = paper.path("M10 10L90 90 ..... z");

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 relativ开发者_如何学Pythone to raphael's canvas. Any idea? thx


Something like

var x = Math.floor((event.pageX-$("#paper").offset().left));

Obviously this is using jQuerys $ to get the paper element..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜