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 指的是藍框

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