Commit c04ff844 authored by wjf's avatar wjf

l

parent 985aecee
import { SCALE_MODES, TEXT_ALIGN, TEXT_lINETYPE, VERTICAL_ALIGN } from "../const"; import { SCALE_MODES, TEXT_ALIGN, TEXT_lINETYPE, VERTICAL_ALIGN } from "../const";
import Texture from "../texture/Texture"; import Texture from "../texture/Texture";
import { getRGBA } from "../utils"; import { getRGBA, hex2string } from "../utils";
import { Rectangle } from "../math"; import { Rectangle } from "../math";
import Sprite from "../display/Sprite"; import Sprite from "../display/Sprite";
import { Event } from "../events"; import { Event } from "../events";
...@@ -305,7 +305,7 @@ export class TextField extends Sprite { ...@@ -305,7 +305,7 @@ export class TextField extends Sprite {
* @since 1.0.0 * @since 1.0.0
* @default #fff * @default #fff
*/ */
public set fillColor(value: string) { public set fillColor(value: any) {
if (this._fillColor != value) { if (this._fillColor != value) {
this._fillColor = value; this._fillColor = value;
this.dirty = true; this.dirty = true;
...@@ -313,11 +313,11 @@ export class TextField extends Sprite { ...@@ -313,11 +313,11 @@ export class TextField extends Sprite {
; ;
} }
public get fillColor(): string { public get fillColor(): any {
return this._fillColor; return this._fillColor;
} }
private _fillColor: string = "#ffffff"; private _fillColor: any = "#ffffff";
/** /**
* 文本的描边颜色值 * 文本的描边颜色值
...@@ -451,12 +451,10 @@ export class TextField extends Sprite { ...@@ -451,12 +451,10 @@ export class TextField extends Sprite {
ctx.textAlign = s._textAlign || TEXT_ALIGN.LEFT; ctx.textAlign = s._textAlign || TEXT_ALIGN.LEFT;
//暂时没开放 //暂时没开放
ctx.textBaseline = "top"; ctx.textBaseline = "top";
//数字转换
if (s._textAlpha === 1) { if (typeof (s._fillColor) == "number") s._fillColor = hex2string(s._fillColor);
ctx.fillStyle = s._fillColor; //获取fillStyle
} else { ctx.fillStyle = s._textAlpha === 1 ? s._fillColor : getRGBA(s._fillColor, s._textAlpha);
ctx.fillStyle = 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