private static void HandleMouseDown(SceneView view, int id, int button)
 {
     s_Dragged = false;
     if (Tools.viewToolActive)
     {
         UnityEditor.ViewTool viewTool = Tools.viewTool;
         if (Tools.s_LockedViewTool != viewTool)
         {
             Event current = Event.current;
             GUIUtility.hotControl  = id;
             Tools.s_LockedViewTool = viewTool;
             s_StartZoom            = view.size;
             s_ZoomSpeed            = Mathf.Max(Mathf.Abs(s_StartZoom), 0.3f);
             s_TotalMotion          = 0f;
             if (view != null)
             {
                 view.Focus();
             }
             if (Toolbar.get != null)
             {
                 Toolbar.get.Repaint();
             }
             EditorGUIUtility.SetWantsMouseJumping(1);
             current.Use();
             GUIUtility.ExitGUI();
         }
     }
 }
        public override void Update(CameraState cameraState, Camera cam)
        {
            Event current = Event.current;

            if (current.type == EventType.MouseUp)
            {
                this.m_CurrentViewTool = UnityEditor.ViewTool.None;
            }
            if (current.type == EventType.MouseDown)
            {
                int  button = current.button;
                bool flag   = current.control && (Application.platform == RuntimePlatform.OSXEditor);
                if (button == 2)
                {
                    this.m_CurrentViewTool = UnityEditor.ViewTool.Pan;
                }
                else if (((button <= 0) && flag) || ((button == 1) && current.alt))
                {
                    this.m_CurrentViewTool = UnityEditor.ViewTool.Zoom;
                    this.m_StartZoom       = cameraState.viewSize.value;
                    this.m_ZoomSpeed       = Mathf.Max(Mathf.Abs(this.m_StartZoom), 0.3f);
                    this.m_TotalMotion     = 0f;
                }
                else if (button <= 0)
                {
                    this.m_CurrentViewTool = UnityEditor.ViewTool.Orbit;
                }
                else if ((button == 1) && !current.alt)
                {
                    this.m_CurrentViewTool = UnityEditor.ViewTool.FPS;
                }
            }
            switch (current.type)
            {
            case EventType.MouseUp:
                this.HandleCameraMouseUp();
                break;

            case EventType.MouseDrag:
                this.HandleCameraMouseDrag(cameraState, cam);
                break;

            case EventType.KeyDown:
                this.HandleCameraKeyDown();
                break;

            case EventType.KeyUp:
                this.HandleCameraKeyUp();
                break;

            case EventType.ScrollWheel:
                this.HandleCameraScrollWheel(cameraState);
                break;

            case EventType.Layout:
            {
                Vector3 movementDirection = this.GetMovementDirection();
                if (movementDirection.sqrMagnitude != 0f)
                {
                    cameraState.pivot.value += cameraState.rotation.value * movementDirection;
                }
                break;
            }
            }
        }
 private void ResetCameraControl()
 {
     this.m_CurrentViewTool = UnityEditor.ViewTool.None;
     this.m_Motion          = Vector3.zero;
 }