使用raphael.js/openlayers.js库成功附加单击和双击事件的方法

问题描述:

我的一个朋友在尝试同时附加单击和双击事件以在某个层上各自拥有不同的功能时遇到了一些问题.他正在尝试使用raphael.js和openlayers.js库执行此操作,但没有成功.我们对此发布进行了一些研究和解决方案:在由doubleclick阻止的点击上不是不能完全正常工作.

A friend of mine is having some issues while trying to attach click and double click events simultaneously to do different things each own for a certain layer. He is trying to do it with raphael.js and openlayers.js libraries with no success. We did some research and the solutions on this post: on click stopped by doubleclick aren't working completely.

有没有一种有效的方法来做到这一点?

Is there an efficient way to do this?

谢谢.

您是否在寻找 :

Are you looking for this:

var paper = Raphael('area', 300, 300);

var r = paper.rect(100, 100, 70, 35, 5).attr({fill: 'red'});

r.click(function() {
    this.animate({fill: 'blue'}, 200);
});

r.dblclick(function() {
    this.animate({fill: 'green'}, 200);
});