Commit c04ff844 authored by wjf's avatar wjf

l

parent 985aecee
import { SCALE_MODES, TEXT_ALIGN, TEXT_lINETYPE, VERTICAL_ALIGN } from "../const";
import Texture from "../texture/Texture";
import { getRGBA } from "../utils";
import { getRGBA, hex2string } from "../utils";
import { Rectangle } from "../math";
import Sprite from "../display/Sprite";
import { Event } from "../events";
......@@ -305,7 +305,7 @@ export class TextField extends Sprite {
* @since 1.0.0
* @default #fff
*/
public set fillColor(value: string) {
public set fillColor(value: any) {
if (this._fillColor != value) {
this._fillColor = value;
this.dirty = true;
......@@ -313,11 +313,11 @@ export class TextField extends Sprite {
;
}
public get fillColor(): string {
public get fillColor(): any {
return this._fillColor;
}
private _fillColor: string = "#ffffff";
private _fillColor: any = "#ffffff";
/**
* 文本的描边颜色值
......@@ -451,12 +451,10 @@ export class TextField extends Sprite {
ctx.textAlign = s._textAlign || TEXT_ALIGN.LEFT;
//暂时没开放
ctx.textBaseline = "top";
if (s._textAlpha === 1) {
ctx.fillStyle = s._fillColor;
} else {
ctx.fillStyle = getRGBA(s._fillColor, s._textAlpha)
}
//数字转换
if (typeof (s._fillColor) == "number") s._fillColor = hex2string(s._fillColor);
//获取fillStyle
ctx.fillStyle = s._textAlpha === 1 ? s._fillColor : getRGBA(s._fillColor, s._textAlpha);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment