UnityEditor.SpriteUtilityWindow.HandleZoom C# (CSharp) Method

HandleZoom() protected method

protected HandleZoom ( ) : void
return void
        protected void HandleZoom()
        {
            bool flag = Event.current.alt && (Event.current.button == 1);
            if (flag)
            {
                EditorGUIUtility.AddCursorRect(this.m_TextureViewRect, MouseCursor.Zoom);
            }
            if ((((Event.current.type == EventType.MouseUp) || (Event.current.type == EventType.MouseDown)) && flag) || (((Event.current.type == EventType.KeyUp) || (Event.current.type == EventType.KeyDown)) && (Event.current.keyCode == KeyCode.LeftAlt)))
            {
                base.Repaint();
            }
            if ((Event.current.type == EventType.ScrollWheel) || (((Event.current.type == EventType.MouseDrag) && Event.current.alt) && (Event.current.button == 1)))
            {
                float num = 1f - (Event.current.delta.y * ((Event.current.type != EventType.ScrollWheel) ? -0.005f : 0.03f));
                float num2 = this.m_Zoom * num;
                float num3 = Mathf.Clamp(num2, this.GetMinZoom(), 50f);
                if (num3 != this.m_Zoom)
                {
                    this.m_Zoom = num3;
                    if (num2 != num3)
                    {
                        num /= num2 / num3;
                    }
                    this.m_ScrollPosition = (Vector2) (this.m_ScrollPosition * num);
                    float num4 = (Event.current.mousePosition.x / this.m_TextureViewRect.width) - 0.5f;
                    float num5 = (Event.current.mousePosition.y / this.m_TextureViewRect.height) - 0.5f;
                    float num6 = num4 * (num - 1f);
                    float num7 = num5 * (num - 1f);
                    Rect maxScrollRect = this.maxScrollRect;
                    this.m_ScrollPosition.x += num6 * (maxScrollRect.width / 2f);
                    this.m_ScrollPosition.y += num7 * (maxScrollRect.height / 2f);
                    Event.current.Use();
                }
            }
        }