2013-12-14 57 views
1

我無法將transformMatrix應用於Fabric中的Text對象。Fabric.js文本轉換不起作用

的問題在這裏說明: http://jsfiddle.net/d8Tkj/1/

var canvas = new fabric.Canvas('c'); 

canvas.add(new fabric.Text('Transform does not work', { 
    fontSize:20, 
    left:0, 
    top:0, 
    'transformMatrix': [1,0,0,1,0,200] // should translate by 200px down. But this does not work 
})); 


canvas.add(new fabric.Text('But this works', { 
    fontSize:20, 
    left:0, 
    top:200 
})); 

// transform works on other objects: 
canvas.add(new fabric.Rect({ 
    left:0, 
    top:0, 
    width:50, 
    height:50, 
    fill:'red', 
    'transformMatrix': [1,0,0,1,100,100] 
})); 

有其他人看到這個問題?我知道我可以通過改變位置來翻譯,但我需要能夠爲我的應用程序使用變換矩陣。

+0

我不知道transformMatrix'應該如何'互動對象。請注意,矩形的可拖動區域不是呈現矩形本身的位置。 – kangax

+0

好的,我以前沒有注意到。但是,transformMatrix不適用於Text對象嗎? – user1690179

+0

看起來不像。請在github上提出問題,我會研究它。 – kangax

回答

0
canvas.add(new fabric.Rect({ 
    left:100, 
    top:100, 
    width:50, 
    height:50, 
    fill:'red', 
    'transformMatrix': [1,0,0,1,0,0] 
})); 

試舉頂部和左側,而不是給它在變換矩陣