Egret之Label属性width与textWidth的区别

Egret之Label属性width与textWidth的区别

一 : 此Label的范围矩形框(蓝框)明显比文本实际占用的矩形(红框)要大

二 : 代码如下

module app{
    export class AAA extends eui.Component{
    private qqq : eui.Label = null;
    private mmm : eui.Label = null;
    public constructor(){
        super();
        this.skinName = "resource/eui_skins/aaa.exml";
    }

    protected childrenCreated() : void{
        super.childrenCreated();
        console.log( `width : ${this.qqq.width}` );
        console.log( `heigth : ${this.qqq.height}` );
        console.log( `textWidth : ${this.qqq.textWidth}` );
        console.log( `textHeigth : ${this.qqq.textHeight}` );
    }
}
}

三 : 结果

Egret之Label属性width与textWidth的区别
可知 : width / height 指的是蓝框

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章