UnityEngine.TextEditor.UpdateScrollOffset C# (CSharp) Method

UpdateScrollOffset() private method

private UpdateScrollOffset ( ) : void
return void
        private void UpdateScrollOffset()
        {
            int cursorIndex = this.cursorIndex;
            this.graphicalCursorPos = this.style.GetCursorPixelPosition(new Rect(0f, 0f, this.position.width, this.position.height), this.m_Content, cursorIndex);
            Rect rect3 = this.style.padding.Remove(this.position);
            Vector2 vector = new Vector2(this.style.CalcSize(this.m_Content).x, this.style.CalcHeight(this.m_Content, this.position.width));
            if (vector.x < this.position.width)
            {
                this.scrollOffset.x = 0f;
            }
            else if (this.m_RevealCursor)
            {
                if ((this.graphicalCursorPos.x + 1f) > (this.scrollOffset.x + rect3.width))
                {
                    this.scrollOffset.x = this.graphicalCursorPos.x - rect3.width;
                }
                if (this.graphicalCursorPos.x < (this.scrollOffset.x + this.style.padding.left))
                {
                    this.scrollOffset.x = this.graphicalCursorPos.x - this.style.padding.left;
                }
            }
            if (vector.y < rect3.height)
            {
                this.scrollOffset.y = 0f;
            }
            else if (this.m_RevealCursor)
            {
                if ((this.graphicalCursorPos.y + this.style.lineHeight) > ((this.scrollOffset.y + rect3.height) + this.style.padding.top))
                {
                    this.scrollOffset.y = ((this.graphicalCursorPos.y - rect3.height) - this.style.padding.top) + this.style.lineHeight;
                }
                if (this.graphicalCursorPos.y < (this.scrollOffset.y + this.style.padding.top))
                {
                    this.scrollOffset.y = this.graphicalCursorPos.y - this.style.padding.top;
                }
            }
            if ((this.scrollOffset.y > 0f) && ((vector.y - this.scrollOffset.y) < rect3.height))
            {
                this.scrollOffset.y = ((vector.y - rect3.height) - this.style.padding.top) - this.style.padding.bottom;
            }
            this.scrollOffset.y = (this.scrollOffset.y >= 0f) ? this.scrollOffset.y : 0f;
            this.m_RevealCursor = false;
        }