Fabric.js How to resize IText horizontally without stretching the text

社会主义新天地 提交于 2019-12-03 14:36:37

try use latest fabricjs version ( 1.6.0.rc1 ) and instead of using fabric.IText use fabric.Textbox.

This new class has the properties you are looking for, the controls normally used for scaling are instead used for resizing the element and the text flows inside it.

I was not able to make the latest fabric.Textbox work exactly like I wanted.

Luckily, I found a way of making the fabric.ITextcenter horizontally when the parent fabric.Group is resized horizontally and also make the same fabric.IText Text grow in size based on the vertical resize. No ugly text stretch.

Here is the solution:

https://jsfiddle.net/t44wyday/46/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!