UNPKG

laya-coreui-es

Version:

laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改

52 lines (51 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WordText = void 0; class WordText { constructor() { this.save = []; this.toUpperCase = null; this.width = -1; this.pageChars = []; this.startID = 0; this.startIDStroke = 0; this.lastGCCnt = 0; this.splitRender = false; this.scalex = 1; this.scaley = 1; } setText(txt) { this.changed = true; this._text = txt; this.width = -1; this.cleanCache(); } toString() { return this._text; } get length() { return this._text ? this._text.length : 0; } charCodeAt(i) { return this._text ? this._text.charCodeAt(i) : NaN; } charAt(i) { return this._text ? this._text.charAt(i) : null; } cleanCache() { let pagecharse = this.pageChars; for (var i in pagecharse) { let p = pagecharse[i]; var tex = p.tex; var words = p.words; if (words.length == 1 && tex && tex.ri) { tex.destroy(); } } this.pageChars = []; this.startID = 0; this.scalex = 1; this.scaley = 1; } } exports.WordText = WordText;