Exemplo n.º 1
0
        protected bool Equals(YGLayout other)
        {
            bool isEqual = YGFloatArrayEqual(Position, other.Position) &&
                           YGFloatArrayEqual(Dimensions, other.Dimensions) &&
                           YGFloatArrayEqual(Margin, other.Margin) &&
                           YGFloatArrayEqual(Border, other.Border) &&
                           YGFloatArrayEqual(Padding, other.Padding) &&
                           Direction == other.Direction &&
                           HadOverflow == other.HadOverflow &&
                           LastOwnerDirection == other.LastOwnerDirection &&
                           NextCachedMeasurementsIndex == other.NextCachedMeasurementsIndex &&
                           CachedLayout == other.CachedLayout &&
                           ComputedFlexBasis == other.ComputedFlexBasis;

            for (var i = 0; i < CachedMeasurements.Length && isEqual; ++i)
            {
                isEqual = CachedMeasurements[i] == other.CachedMeasurements[i];
            }

            if (!YogaIsUndefined(MeasuredDimensions[0]) || !YogaIsUndefined(other.MeasuredDimensions[0]))
            {
                isEqual = isEqual && YGFloatsEqual(MeasuredDimensions[0], other.MeasuredDimensions[0]);
            }

            if (!YogaIsUndefined(MeasuredDimensions[1]) || !YogaIsUndefined(other.MeasuredDimensions[1]))
            {
                isEqual = isEqual && YGFloatsEqual(MeasuredDimensions[1], other.MeasuredDimensions[1]);
            }

            return(isEqual);
        }
Exemplo n.º 2
0
        public YGLayout(YGLayout other)
        {
            Array.Copy(other.Position, Position, Position.Length);
            Array.Copy(other.Dimensions, Dimensions, Dimensions.Length);
            Array.Copy(other.Margin, Margin, Margin.Length);
            Array.Copy(other.Border, Border, Border.Length);
            Array.Copy(other.Padding, Padding, Padding.Length);

            ComputedFlexBasisGeneration = other.ComputedFlexBasisGeneration;
            ComputedFlexBasis           = other.ComputedFlexBasis;

            GenerationCount = other.GenerationCount;

            LastOwnerDirection = other.LastOwnerDirection;

            NextCachedMeasurementsIndex = other.NextCachedMeasurementsIndex;
            Array.Copy(other.CachedMeasurements, CachedMeasurements, CachedMeasurements.Length);
            Array.Copy(other.MeasuredDimensions, MeasuredDimensions, MeasuredDimensions.Length);

            CachedLayout = new YGCachedMeasurement(other.CachedLayout);
            Direction    = other.Direction;
            HadOverflow  = other.HadOverflow;
        }