laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
42 lines (41 loc) • 1.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DrawStyle = void 0;
const ColorUtils_1 = require("../../utils/ColorUtils");
class DrawStyle {
static create(value) {
if (value) {
var color = (value instanceof ColorUtils_1.ColorUtils) ? value : ColorUtils_1.ColorUtils.create(value);
return color._drawStyle || (color._drawStyle = new DrawStyle(value));
}
return DrawStyle.DEFAULT;
}
constructor(value) {
this.setValue(value);
}
setValue(value) {
if (value) {
this._color = (value instanceof ColorUtils_1.ColorUtils) ? value : ColorUtils_1.ColorUtils.create(value);
}
else
this._color = ColorUtils_1.ColorUtils.create("#000000");
}
reset() {
this._color = ColorUtils_1.ColorUtils.create("#000000");
}
toInt() {
return this._color.numColor;
}
equal(value) {
if (typeof (value) == 'string')
return this._color.strColor === value;
if (value instanceof ColorUtils_1.ColorUtils)
return this._color.numColor === value.numColor;
return false;
}
toColorStr() {
return this._color.strColor;
}
}
exports.DrawStyle = DrawStyle;
DrawStyle.DEFAULT = new DrawStyle("#000000");