protected virtual void RecalculateBound() { Vector2 new_pos = GNewUITools.GetAlignedPivot(NewAlign.Left); if (IsVertical) { new_pos = GNewUITools.GetAlignedPivot(NewAlign.Top); } RectTrans.pivot = new_pos; RectTrans.anchorMax = new_pos; RectTrans.anchorMin = new_pos; _RealBound = PackBound(_ItemCount); if (_RealBound.z < 0) { _RealBound.z = RectTrans.rect.width; } if (_RealBound.w < 0) { _RealBound.w = RectTrans.rect.height; } Vector2 new_size = new Vector2(_RealBound.z, _RealBound.w); this.RectTrans.sizeDelta = GNewUITools.GetDeltaSize(RectTrans, new_size); }
protected virtual void RecalculateBound() { if (_IsExpandItem) { if (IsVertical) { _NumberOfColumn = 1; } else { _NumberOfRow = 1; } } SetPivotAnchor(RectTrans, _Align); _RealBound = this.PackBound(this._ItemCount); if (_RealBound.z < 0) { _RealBound.z = RectTrans.rect.width; } if (_RealBound.w < 0) { _RealBound.w = RectTrans.rect.height; } //SetPivotAnchor(RectTrans, _Align); Vector2 new_size = new Vector2(_RealBound.z, _RealBound.w); this.RectTrans.sizeDelta = GNewUITools.GetDeltaSize(RectTrans, new_size); if (_LayoutElem != null) { _LayoutElem.preferredHeight = new_size.y; _LayoutElem.preferredWidth = new_size.x; _LayoutElem.enabled = false; _LayoutElem.enabled = true; } }