laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
38 lines (37 loc) • 1.14 kB
JavaScript
import { ColorUtils } from "../../utils/ColorUtils";
export class DrawStyle {
static create(value) {
if (value) {
var color = (value instanceof ColorUtils) ? value : 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) ? value : ColorUtils.create(value);
}
else
this._color = ColorUtils.create("#000000");
}
reset() {
this._color = ColorUtils.create("#000000");
}
toInt() {
return this._color.numColor;
}
equal(value) {
if (typeof (value) == 'string')
return this._color.strColor === value;
if (value instanceof ColorUtils)
return this._color.numColor === value.numColor;
return false;
}
toColorStr() {
return this._color.strColor;
}
}
DrawStyle.DEFAULT = new DrawStyle("#000000");