在许多画布框架中,有一个maxWidth和maxHeight来控制自动换行。
在EaselJS设置中,maxWidth很简单,但有没有办法将maxHeight设置为文本? (高效)
答案 0 :(得分:0)
对于其他任何人来说,olsn的评论就是答案......只需使用面具: createjs.com/Docs/EaselJS/classes/Text.html#property_mask
答案 1 :(得分:0)
txt.lineWidth = 200;
var txt = new createjs.Text( 'txt sdfj sdfks dflkjsd flksdjf sdklfj sdlkfjsd fkljsdfsdjkf', "21px Arial", "#000" );
container.addChild( txt );
var w = ( txt.getMeasuredWidth() ) * txt.scaleX;
var h = ( txt.getMeasuredHeight() ) * txt.scaleY;
txt.regY = h / 2;
txt.textAlign = 'center'
txt.lineWidth = 200;
txt.x = __shape.x;
txt.y = __shape.y;
txt.color = 'black';