UnityEditor.Handles.DoPlanarHandle C# (CSharp) Method

DoPlanarHandle() private static method

private static DoPlanarHandle ( PlaneHandle planeID, Vector3 position, Quaternion rotation, float handleSize ) : Vector3
planeID PlaneHandle
position Vector3
rotation UnityEngine.Quaternion
handleSize float
return Vector3
        private static Vector3 DoPlanarHandle(PlaneHandle planeID, Vector3 position, Quaternion rotation, float handleSize)
        {
            Vector3 normalized;
            int num = 0;
            int num2 = 0;
            int hint = 0;
            bool flag = (!Tools.s_Hidden && EditorApplication.isPlaying) && GameObjectUtility.ContainsStatic(Selection.gameObjects);
            if (planeID != PlaneHandle.xzPlane)
            {
                if (planeID == PlaneHandle.xyPlane)
                {
                    num = 0;
                    num2 = 1;
                    Handles.color = !flag ? zAxisColor : staticColor;
                    hint = s_xyAxisMoveHandleHash;
                }
                else if (planeID == PlaneHandle.yzPlane)
                {
                    num = 1;
                    num2 = 2;
                    Handles.color = !flag ? xAxisColor : staticColor;
                    hint = s_yzAxisMoveHandleHash;
                }
            }
            else
            {
                num = 0;
                num2 = 2;
                Handles.color = !flag ? yAxisColor : staticColor;
                hint = s_xzAxisMoveHandleHash;
            }
            int num4 = (3 - num2) - num;
            Color color = Handles.color;
            Matrix4x4 matrixx = Matrix4x4.TRS(position, rotation, Vector3.one);
            if (Camera.current.orthographic)
            {
                normalized = matrixx.inverse.MultiplyVector((Vector3) (SceneView.currentDrawingSceneView.cameraTargetRotation * -Vector3.forward)).normalized;
            }
            else
            {
                normalized = matrixx.inverse.MultiplyPoint(SceneView.currentDrawingSceneView.camera.transform.position).normalized;
            }
            int controlID = GUIUtility.GetControlID(hint, FocusType.Keyboard);
            if ((Mathf.Abs(normalized[num4]) < 0.05f) && (GUIUtility.hotControl != controlID))
            {
                Handles.color = color;
                return position;
            }
            if (!currentlyDragging)
            {
                s_PlanarHandlesOctant[num] = (normalized[num] >= -0.01f) ? ((float) 1) : ((float) (-1));
                s_PlanarHandlesOctant[num2] = (normalized[num2] >= -0.01f) ? ((float) 1) : ((float) (-1));
            }
            Vector3 offset = s_PlanarHandlesOctant;
            offset[num4] = 0f;
            offset = (Vector3) (rotation * ((offset * handleSize) * 0.5f));
            Vector3 zero = Vector3.zero;
            Vector3 vector7 = Vector3.zero;
            Vector3 handleDir = Vector3.zero;
            zero[num] = 1f;
            vector7[num2] = 1f;
            handleDir[num4] = 1f;
            zero = (Vector3) (rotation * zero);
            vector7 = (Vector3) (rotation * vector7);
            handleDir = (Vector3) (rotation * handleDir);
            verts[0] = (position + offset) + ((Vector3) (((zero + vector7) * handleSize) * 0.5f));
            verts[1] = (position + offset) + ((Vector3) (((-zero + vector7) * handleSize) * 0.5f));
            verts[2] = (position + offset) + ((Vector3) (((-zero - vector7) * handleSize) * 0.5f));
            verts[3] = (position + offset) + ((Vector3) (((zero - vector7) * handleSize) * 0.5f));
            DrawSolidRectangleWithOutline(verts, new Color(Handles.color.r, Handles.color.g, Handles.color.b, 0.1f), new Color(0f, 0f, 0f, 0f));
            if (<>f__mg$cache6 == null)
            {
                <>f__mg$cache6 = new CapFunction(Handles.RectangleHandleCap);