public static void DoViewTool(Transform cameraTransform, SceneView view) { Event current = Event.current; int num = SceneViewMotion.s_ViewToolID; EventType typeForControl = current.GetTypeForControl(num); float d = 0f; if (view && Tools.s_LockedViewTool == ViewTool.FPS) { view.FixNegativeSize(); d = (view.pivot - cameraTransform.position).magnitude; } switch (typeForControl) { case EventType.MouseDown: SceneViewMotion.HandleMouseDown(view, num, current.button); break; case EventType.MouseUp: SceneViewMotion.HandleMouseUp(view, num, current.button, current.clickCount); break; case EventType.MouseDrag: SceneViewMotion.HandleMouseDrag(cameraTransform, view, num); break; case EventType.KeyDown: SceneViewMotion.HandleKeyDown(view); break; case EventType.KeyUp: SceneViewMotion.HandleKeyUp(); break; case EventType.ScrollWheel: SceneViewMotion.HandleScrollWheel(view, !current.alt); break; case EventType.Layout: { Vector3 movementDirection = SceneViewMotion.GetMovementDirection(); if (GUIUtility.hotControl == num && movementDirection.sqrMagnitude != 0f) { cameraTransform.position += cameraTransform.rotation * movementDirection; } break; } } if (view && Tools.s_LockedViewTool == ViewTool.FPS) { if (!view.orthographic) { view.rotation = cameraTransform.rotation; } view.pivot = cameraTransform.position + cameraTransform.forward * d; view.Repaint(); } }
public static void DoViewTool(SceneView view) { Event current = Event.current; int num = SceneViewMotion.s_ViewToolID; EventType typeForControl = current.GetTypeForControl(num); if (view && Tools.s_LockedViewTool == ViewTool.FPS) { view.FixNegativeSize(); } switch (typeForControl) { case EventType.MouseDown: SceneViewMotion.HandleMouseDown(view, num, current.button); break; case EventType.MouseUp: SceneViewMotion.HandleMouseUp(view, num, current.button, current.clickCount); break; case EventType.MouseDrag: SceneViewMotion.HandleMouseDrag(view, num); break; case EventType.KeyDown: SceneViewMotion.HandleKeyDown(view); break; case EventType.KeyUp: SceneViewMotion.HandleKeyUp(); break; case EventType.ScrollWheel: SceneViewMotion.HandleScrollWheel(view, view.in2DMode == current.alt); break; case EventType.Layout: { Vector3 movementDirection = SceneViewMotion.GetMovementDirection(); if (GUIUtility.hotControl == num && movementDirection.sqrMagnitude != 0f) { view.pivot += view.rotation * movementDirection; view.Repaint(); } break; } case EventType.Used: if (GUIUtility.hotControl != num && SceneViewMotion.s_CurrentState != SceneViewMotion.MotionState.kInactive) { SceneViewMotion.ResetDragState(); } break; } }
public static void DoViewTool(SceneView view) { Event current = Event.current; int viewToolId = SceneViewMotion.s_ViewToolID; EventType typeForControl = current.GetTypeForControl(viewToolId); if ((bool)((Object)view) && Tools.s_LockedViewTool == ViewTool.FPS) { view.FixNegativeSize(); } switch (typeForControl) { case EventType.MouseDown: SceneViewMotion.HandleMouseDown(view, viewToolId, current.button); break; case EventType.MouseUp: SceneViewMotion.HandleMouseUp(view, viewToolId, current.button, current.clickCount); break; case EventType.MouseDrag: SceneViewMotion.HandleMouseDrag(view, viewToolId); break; case EventType.KeyDown: SceneViewMotion.HandleKeyDown(view); break; case EventType.KeyUp: SceneViewMotion.HandleKeyUp(); break; case EventType.ScrollWheel: SceneViewMotion.HandleScrollWheel(view, !current.alt); break; case EventType.Layout: Vector3 movementDirection = SceneViewMotion.GetMovementDirection(); if (GUIUtility.hotControl != viewToolId || (double)movementDirection.sqrMagnitude == 0.0) { break; } view.pivot = view.pivot + view.rotation * movementDirection; view.Repaint(); break; } }