2013-05-08 42 views

回答

0

所以,當你選擇一個對象,你可以選擇整個組?

您是否嘗試過: canvas.selection = true; // @ DOC http://fabricjs.com/docs/fabric.Canvas.html

否則你必須設計這樣的事情(不完整):

canvas.on({ 
    'object:moving': function(e) { 
    var movObj = e.target; 
    var arrGroup = getObjects(); 
    for (var i = 0; i < arrGroup.length; i++) { 
     // if(arrGroup[i] != movObj) // maybe at this for preformance 
     arrGroup[i].left = calcDiff; // calc the diff 
     arrGroup[i].top = calcDiff; 
    } 
    }, 

}); 
相關問題