Ejemplo n.º 1
0
        protected bool Equals(YogaLayout other)
        {
            bool isEqual = Position == other.Position &&
                           FloatsEqual(Width, other.Width) &&
                           FloatsEqual(Height, other.Height) &&
                           Margin == other.Margin &&
                           Border == other.Border &&
                           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 (MeasuredDimensions.Width.HasValue() || other.MeasuredDimensions.Width.HasValue())
            {
                isEqual = isEqual && FloatsEqual(MeasuredDimensions.Width, other.MeasuredDimensions.Width);
            }

            if (MeasuredDimensions.Height.HasValue() || other.MeasuredDimensions.Height.HasValue())
            {
                isEqual = isEqual && FloatsEqual(MeasuredDimensions.Height, other.MeasuredDimensions.Height);
            }

            return(isEqual);
        }
Ejemplo n.º 2
0
        public YogaLayout(YogaLayout other)
        {
            Position = new LTRBEdge(other.Position);
            Width    = other.Width;
            Height   = other.Height;
            Margin   = new LTRBEdge(other.Margin);
            Border   = new LTRBEdge(other.Border);
            Padding  = new LTRBEdge(other.Padding);

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

            GenerationCount = other.GenerationCount;

            LastOwnerDirection = other.LastOwnerDirection;

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

            MeasuredDimensions = new DimensionsFloat(other.MeasuredDimensions);
            CachedLayout       = new YogaCachedMeasurement(other.CachedLayout);
            Direction          = other.Direction;
            HadOverflow        = other.HadOverflow;
        }