Skip to content

Commit

Permalink
remove old attribute & add visible
Browse files Browse the repository at this point in the history
  • Loading branch information
LinYunMo committed Sep 15, 2023
1 parent 33bc9d1 commit 13d32f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
5 changes: 0 additions & 5 deletions cocos/2d/components/label-outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ import { Label } from './label';
@requireComponent(Label)
@executeInEditMode
export class LabelOutline extends Component {
@serializable
protected _color = new Color(0, 0, 0, 255);
@serializable
protected _width = 2;

/**
* @en
* Outline color.
Expand Down
7 changes: 0 additions & 7 deletions cocos/2d/components/label-shadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ import { Label } from './label';
@requireComponent(Label)
@executeInEditMode
export class LabelShadow extends Component {
@serializable
protected _color = new Color(0, 0, 0, 255);
@serializable
protected _offset = new Vec2(2, 2);
@serializable
protected _blur = 2;

/**
* @en
* Shadow color.
Expand Down
18 changes: 10 additions & 8 deletions cocos/2d/components/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,10 @@ export class Label extends UIRenderer {
** Outline effect used to change the display, only for system fonts or TTF fonts.
**
** @zh
** 描边效果组件,用于字体描边,只能用于系统字体
** 描边效果组件,用于字体描边,只能用于系统字体或 ttf 字体
**/
@editable
@visible(function (this: Label) { return !(this._font instanceof BitmapFont); })

Check warning on line 614 in cocos/2d/components/label.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
@displayOrder(19)
@tooltip('i18n:label.outline_enable')
get enableOutline (): boolean {
Expand All @@ -630,7 +631,7 @@ export class Label extends UIRenderer {
* 改变描边的颜色。
*/
@editable
@visible(function (this: Label) { return this._enableOutline; })
@visible(function (this: Label) { return this._enableOutline && !(this._font instanceof BitmapFont); })

Check warning on line 634 in cocos/2d/components/label.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
@displayOrder(20)
@tooltip('i18n:label.outline_color')
get outlineColor (): Color {
Expand All @@ -650,7 +651,7 @@ export class Label extends UIRenderer {
* 改变描边的宽度。
*/
@editable
@visible(function (this: Label) { return this._enableOutline; })
@visible(function (this: Label) { return this._enableOutline && !(this._font instanceof BitmapFont); })

Check warning on line 654 in cocos/2d/components/label.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
@displayOrder(21)
@tooltip('i18n:label.outline_width')
get outlineWidth (): number {
Expand All @@ -663,10 +664,11 @@ export class Label extends UIRenderer {
}

/**
* @en Shadow effect for Label component, only for system fonts or TTF fonts.
* @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。
* @en Shadow effect for Label component, only for system fonts or TTF fonts. Disabled when cache mode is char.
* @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。在缓存模式为 char 时不可用。
*/
@editable
@visible(function (this: Label) { return !(this._font instanceof BitmapFont) && (this.cacheMode !== CacheMode.CHAR); })

Check warning on line 671 in cocos/2d/components/label.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
@displayOrder(22)
@tooltip('i18n:label.shadow_enable')
get enableShadow (): boolean {
Expand All @@ -686,7 +688,7 @@ export class Label extends UIRenderer {
* 阴影的颜色。
*/
@editable
@visible(function (this: Label) { return this._enableShadow; })
@visible(function (this: Label) { return this._enableShadow && !(this._font instanceof BitmapFont) && (this.cacheMode !== CacheMode.CHAR); })

Check warning on line 691 in cocos/2d/components/label.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
@displayOrder(23)
@tooltip('i18n:label.shadow_color')
get shadowColor (): Color {
Expand All @@ -706,7 +708,7 @@ export class Label extends UIRenderer {
* 字体与阴影的偏移。
*/
@editable
@visible(function (this: Label) { return this._enableShadow; })
@visible(function (this: Label) { return this._enableShadow && !(this._font instanceof BitmapFont) && (this.cacheMode !== CacheMode.CHAR); })

Check warning on line 711 in cocos/2d/components/label.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Unexpected unnamed function
@displayOrder(24)
@tooltip('i18n:label.shadow_offset')
get shadowOffset (): Vec2 {
Expand All @@ -726,7 +728,7 @@ export class Label extends UIRenderer {
* 阴影的模糊程度。
*/
@editable
@visible(function (this: Label) { return this._enableShadow; })
@visible(function (this: Label) { return this._enableShadow && !(this._font instanceof BitmapFont) && (this.cacheMode !== CacheMode.CHAR); })
@displayOrder(25)
@tooltip('i18n:label.shadow_blur')
get shadowBlur (): number {
Expand Down

0 comments on commit 13d32f3

Please sign in to comment.