Пример #1
0
        /// <summary>
        /// Reveal header.
        /// </summary>
        /// <param name="position">Current ScrollRect.content position.</param>
        protected void Reveal(Vector2 position)
        {
            var header_pos = Utilites.GetTopLeftCorner(Header);
            var diff       = IsHorizontal
                                ? -position.x - (-LastPosition.x)
                                : position.y - LastPosition.y;

            if (IsHorizontal)
            {
                header_pos.x = Mathf.Clamp(header_pos.x - diff, -HeaderSize.x, 0f);
            }
            else
            {
                header_pos.y = Mathf.Clamp(header_pos.y + diff, 0f, HeaderSize.y);
            }

            Utilites.SetTopLeftCorner(Header, header_pos);
        }