protected override void OnRectTransformDimensionsChange()
        {
            base.OnRectTransformDimensionsChange();
            CalculateRectTransformDimensions();

            var isDirty = (_dirtyAxis & parentControlledAxis) != 0;

            //We will only set dirty if value of new rect is smaller than preferred size
            if (isDirty &&
                (_dirtyAxis.HasFlag(DrivenAxis.Vertical) && _cachedRectHeight < m_TotalPreferredSize.y) ||
                (_dirtyAxis.HasFlag(DrivenAxis.Horizontal) && _cachedRectWidth < m_TotalPreferredSize.x))
            {
                isDirty = false;
            }

            //Prevent change size while calculating feedback
            if (isDirty)
            {
                SetDirty();
            }
            else
            {
                _dirtyAxis &= ~(DrivenAxis.Horizontal | DrivenAxis.Vertical);
            }
        }
 public virtual void SendFeedback()
 {
     if (group != null && group.rectTransform != null && (_dirtyAxis.HasFlag(DrivenAxis.Ignore) || (group.childrenControlledAxis & _dirtyAxis) != 0))
     {
         group.SetElementDirty(this, _dirtyAxis);
         _dirtyAxis = 0;
     }
 }
예제 #3
0
        public override void SetElementDirty(IFastLayoutFeedback driven, DrivenAxis dirtyAxis)
        {
            if (driven != null && (dirtyAxis.HasFlag(DrivenAxis.Ignore) || (dirtyAxis & childrenControlledAxis) != 0))
            {
                if (!isDirty)
                {
                    MarkLayoutForRebuild();
                }

                //Special case when added element will affect other elements size
                if (dirtyAxis.HasFlag(DrivenAxis.Ignore) &&
                    ((isVertical && m_TotalFlexibleSize.y > 0) ||
                     (!isVertical && m_TotalFlexibleSize.x > 0)))
                {
                    isAxisDirty = true;
                }

                _dirtyChildren.Add(driven);
            }
        }
        public virtual void SetElementDirty(IFastLayoutFeedback driven, DrivenAxis dirtyAxis)
        {
            if (driven != null && (dirtyAxis.HasFlag(DrivenAxis.Ignore) || (dirtyAxis & childrenControlledAxis) != 0))
            {
                if (!isDirty)
                {
                    MarkLayoutForRebuild();
                }

                _dirtyChildren.Add(driven);
            }
        }