laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
42 lines (41 loc) • 1.09 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HTMLChar = void 0;
const Pool_1 = require("./Pool");
class HTMLChar {
constructor() {
this.reset();
}
setData(char, w, h, style) {
this.char = char;
this.charNum = char.charCodeAt(0);
this.x = this.y = 0;
this.width = w;
this.height = h;
this.style = style;
this.isWord = !HTMLChar._isWordRegExp.test(char);
return this;
}
reset() {
this.x = this.y = this.width = this.height = 0;
this.isWord = false;
this.char = null;
this.charNum = 0;
this.style = null;
return this;
}
recover() {
Pool_1.Pool.recover("HTMLChar", this.reset());
}
static create() {
return Pool_1.Pool.getItemByClass("HTMLChar", HTMLChar);
}
_isChar() {
return true;
}
_getCSSStyle() {
return this.style;
}
}
exports.HTMLChar = HTMLChar;
HTMLChar._isWordRegExp = new RegExp("[\\w\.]", "");