laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
43 lines (42 loc) • 1.38 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextStyle = void 0;
const SpriteStyle_1 = require("./SpriteStyle");
const Pool_1 = require("../../utils/Pool");
class TextStyle extends SpriteStyle_1.SpriteStyle {
constructor() {
super(...arguments);
this.italic = false;
}
reset() {
super.reset();
this.italic = false;
this.align = "left";
this.wordWrap = false;
this.leading = 0;
this.padding = [0, 0, 0, 0];
this.bgColor = null;
this.borderColor = null;
this.asPassword = false;
this.stroke = 0;
this.strokeColor = "#000000";
this.bold = false;
this.underline = false;
this.underlineColor = null;
this.currBitmapFont = null;
return this;
}
recover() {
if (this === TextStyle.EMPTY)
return;
Pool_1.Pool.recover("TextStyle", this.reset());
}
static create() {
return Pool_1.Pool.getItemByClass("TextStyle", TextStyle);
}
render(sprite, context, x, y) {
(this.bgColor || this.borderColor) && context.drawRect(x - this.pivotX, y - this.pivotY, sprite.width, sprite.height, this.bgColor, this.borderColor, 1);
}
}
exports.TextStyle = TextStyle;
TextStyle.EMPTY = new TextStyle();