繁体   English   中英

Fabric.js文本转换不起作用

[英]Fabric.js Text transform not working

我无法将transformMatrix应用于Fabric中的Text对象。

此处说明了该问题: 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]
}));

还有其他人看到过这个问题吗? 我知道我可以通过更改位置进行翻译,但是我需要能够为我的应用使用转换矩阵。

在最新版本的fabric.js中,文本的transformMatrix可以正常工作。 1.4.1 https://github.com/kangax/fabric.js/blob/master/CHANGELOG.md

检查上面的链接。

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

尝试给出顶部和左侧,而不是在变换矩阵中给出

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM