From c45f1a8bf7754157b6ac5486957db0fefd29cda3 Mon Sep 17 00:00:00 2001 From: JoneLau <32630749+JoneLau@users.noreply.github.com> Date: Tue, 30 Apr 2019 10:55:20 +0800 Subject: [PATCH] cannot be rendered if string is input by number 0 (#4350) --- cocos/3d/ui/components/label-component.ts | 1 + cocos/3d/ui/components/label-outline-component.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cocos/3d/ui/components/label-component.ts b/cocos/3d/ui/components/label-component.ts index 1618c7456c..c64bd31b7e 100644 --- a/cocos/3d/ui/components/label-component.ts +++ b/cocos/3d/ui/components/label-component.ts @@ -179,6 +179,7 @@ export class LabelComponent extends UIRenderComponent { return this._string; } set string (value) { + value = value.toString(); if (this._string === value) { return; } diff --git a/cocos/3d/ui/components/label-outline-component.ts b/cocos/3d/ui/components/label-outline-component.ts index 6f2b07e8c1..a380279c00 100644 --- a/cocos/3d/ui/components/label-outline-component.ts +++ b/cocos/3d/ui/components/label-outline-component.ts @@ -37,12 +37,18 @@ * node.parent = this.node; */ +import { Component } from '../../../components'; +import { ccclass, executionOrder, menu, property } from '../../../core/data/class-decorator'; import { Color } from '../../../core/value-types'; import { LabelComponent } from './label-component'; -import { UIComponent } from './ui-component'; -export class LabelOutlineComponent extends UIComponent { +@ccclass('cc.LabelOutlineComponent') +@executionOrder(100) +@menu('UI/Render/LabelOutline') +export class LabelOutlineComponent extends Component { + @property private _color = new Color(255, 255, 255, 255); + @property private _width = 1; /** @@ -53,9 +59,11 @@ export class LabelOutlineComponent extends UIComponent { * @example * outline.color = new cc.Color(0.5, 0.3, 0.7, 1.0);; */ + @property get color () { return this._color; } + set color (value) { if (this._color === value){ return; @@ -73,6 +81,7 @@ export class LabelOutlineComponent extends UIComponent { * @example * outline.width = 3; */ + @property get width () { return this._width; }