Beispiel #1
0
        public void CalculateCellSize()
        {
            Rect r = this.rectTransform.rect;

            if (r.width == float.NaN || r.height == float.NaN)
            {
                return;
            }

            ApplySettings(CurrentSettings);

            base.m_Spacing = SpacingSizer.CalculateSize();

            Margin pad = PaddingSizer.CalculateSize();

            pad.CopyValuesTo(base.m_Padding);
        }
Beispiel #2
0
        public void CalculateCellSize()
        {
            Rect r = this.rectTransform.rect;

            if (r.width == float.NaN || r.height == float.NaN)
            {
                return;
            }

            this.ApplySettings(CurrentSettings);

            base.m_Spacing = SpacingSizer.CalculateSize();

            Margin pad = PaddingSizer.CalculateSize();

            pad.CopyValuesTo(base.m_Padding);

            // cell size
            CellSizer.CalculateSize();

            if (fit)
            {
                Vector2 size = CellSizer.LastCalculatedSize;

                switch (base.constraint)
                {
                case Constraint.FixedColumnCount:

                    size.x = GetCellWidth();
                    break;

                case Constraint.FixedRowCount:

                    size.y = GetCellHeight();
                    break;
                }

                CellSizer.OverrideLastCalculatedSize(size);
            }

            base.m_CellSize = CellSizer.LastCalculatedSize;
        }