[英]Fabric js - IText object allow re size but not scale
I am using fabric js for my project, i wondered if its possible to allow the resizing of a text field but not scale the content (font) within. 我正在为我的项目使用Fabric js,我想知道是否有可能允许调整文本字段的大小但不缩放其中的内容(字体)。
see example here: 在这里查看示例:
http://fabricjs.com/test/misc/itext.html http://fabricjs.com/test/misc/itext.html
The examples above seem to scale the text within the iText object. 上面的示例似乎可以缩放iText对象中的文本。 But I want to resize the box itself, so when i make the text box bigger the text inside should go on to one line. 但是我想调整框本身的大小,所以当我将文本框变大时,里面的文本应该继续到一行。
I tried using the following options: 我尝试使用以下选项:
lockScalingY: true,
lockScalingX: false,
lockUniScaling :false
What are you asking for has been developed under the name "fabric.Textbox". 您所要求的名称已经被开发为“ fabric.Textbox”。
var canvas = new fabric.Canvas('canvas'); canvas.add(new fabric.Textbox('hello, im a resizable textbox, please feel free to resize me at will untill you meet size of the longest word', {width:250}))
<script src="http://fabricjs.com/lib/fabric.js"></script> <canvas id='canvas' width="400" height="400" style="border:#000 1px solid;"></canvas>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.