そのため、セット内の特定の要素にドラッグイベントが開始されたときに、セットで変換を使用してドラッグイベントを呼び出そうとしました。しかし、それは少し遅いです。最適化して高速化する方法を知っている人はいますか?
使用している関数は次のとおりです
function dragsymbolsoncanvas(foo){//foo is the set passed.
function dragger(){
this.dx = this.dy = 0;
};
function mover(s){
return function(dx, dy){
(s||this).translate(dx-this.dx,dy-this.dy);
this.dx = dx;
this.dy = dy;
}
};
foo.forEach(function(herp){//set.forEach function from raphaeljs
if(herp.data("candrag")=="true"){
foo.drag(mover(foo), dragger);
}
});
};
ドラッグ可能にしたいピースの上に目に見えない要素を描画し、それらにハンドラーをアタッチせずに、これを高速化する方法はありますか?