From ad6addecf928f32adc8e299ce1f8e6aade603238 Mon Sep 17 00:00:00 2001 From: JoneLau <32630749+JoneLau@users.noreply.github.com> Date: Sat, 7 Dec 2019 22:36:15 +0800 Subject: [PATCH] fix layout err when type changed (#5865) --- cocos/core/components/ui-base/ui-render-component.ts | 1 + cocos/ui/components/layout-component.ts | 4 ++-- cocos/ui/components/mask-component.ts | 4 ++++ cocos/ui/components/page-view-component.ts | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cocos/core/components/ui-base/ui-render-component.ts b/cocos/core/components/ui-base/ui-render-component.ts index fcac3cb51b..2906bfb037 100644 --- a/cocos/core/components/ui-base/ui-render-component.ts +++ b/cocos/core/components/ui-base/ui-render-component.ts @@ -170,6 +170,7 @@ export class UIRenderComponent extends UIComponent { type: Material, displayOrder: 3, tooltip:'源材质', + visible: false, }) get sharedMaterial () { return this._sharedMaterial; diff --git a/cocos/ui/components/layout-component.ts b/cocos/ui/components/layout-component.ts index 2d074193c0..821e08758f 100644 --- a/cocos/ui/components/layout-component.ts +++ b/cocos/ui/components/layout-component.ts @@ -1080,7 +1080,7 @@ export class LayoutComponent extends Component { const newWidth = this._getHorizontalBaseWidth(this.node.children); const fnPositionY = (child: INode) => { - const pos = this._isAlign ? this.node.position : child.position; + const pos = this._isAlign ? Vec3.ZERO : child.position; return pos.y; }; @@ -1091,7 +1091,7 @@ export class LayoutComponent extends Component { const newHeight = this._getVerticalBaseHeight(this.node.children); const fnPositionX = (child: INode) => { - const pos = this._isAlign ? this.node.position : child.position; + const pos = this._isAlign ? Vec3.ZERO : child.position; return pos.x; }; diff --git a/cocos/ui/components/mask-component.ts b/cocos/ui/components/mask-component.ts index f6aa3de3f9..6b171c6a8c 100644 --- a/cocos/ui/components/mask-component.ts +++ b/cocos/ui/components/mask-component.ts @@ -190,6 +190,10 @@ export class MaskComponent extends UIRenderComponent { } set segments (value) { + if(this._segments === value){ + return; + } + this._segments = clamp(value, SEGEMENTS_MIN, SEGEMENTS_MAX); this._updateGraphics(); } diff --git a/cocos/ui/components/page-view-component.ts b/cocos/ui/components/page-view-component.ts index 65ddf9d101..4bb9be3f78 100644 --- a/cocos/ui/components/page-view-component.ts +++ b/cocos/ui/components/page-view-component.ts @@ -210,8 +210,8 @@ export class PageViewComponent extends ScrollViewComponent { } this._indicator = value; - if (this.indicator) { - this.indicator.setPageView(this); + if (this._indicator) { + this._indicator.setPageView(this); } }