1

有没有办法访问点击路径坐标?还有一个:有可能找出路径上前一个最近的拐角吗?

我读过这篇文章,但没有太大帮助: Raphaeljs: access the relative position of a click on a closed path

谢谢你的时间!

4

1 回答 1

3

您是否正在寻找这样的东西:

var paper = Raphael(10, 10, 400, 400);

var path = paper.path("M0 0L10 100L50 100L100 70").attr({"stroke": "#000", "stroke-width": "3"});
path.click(function(event) {
    console.log(this);
    console.log(event.x, event.y);
});

http://jsfiddle.net/sLmHd/2/

编辑

我只是为你做了一个开始。这是一种方式,不是唯一的方式。

我创建了一个包含 2 个数组的对象。x 和 y。

每次点击我都会添加点。(您需要检查要推动该点的索引)还需要检查关闭角是什么。这可能会有所帮助

我希望这会对你有所帮助:http: //jsfiddle.net/fvtPN/

于 2013-05-08T11:10:01.743 回答