0
因此,我試圖在集合中的某些元素具有拖動事件時使用translate和調用拖動事件。但有點慢。有誰知道如何優化使其更快?在RaphaelJS中優化設置的拖放操作
下面是使用
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);
}
});
}功能IM;
有沒有辦法讓這個更快,而不是在我想使可拖動的部分上畫一個看不見的元素,並將處理程序附加到這些部分?
重複,或多或少的這個問題。如果你正在迭代一個集合,你可能沒有很好地使用它。 http://stackoverflow.com/questions/15379158/raphael-js-making-sub-sets-selectively-clickable/15384889#15384889 – 2013-03-22 14:42:50
我知道這是問題的重複,但我不知道更好的方法來用它。我對此很新穎。 – 2013-03-23 15:05:29