HandleDirectionalCursor() private static method

private static HandleDirectionalCursor ( Vector3 handlePosition, Vector3 handlePlaneNormal, Vector3 direction ) : void
handlePosition Vector3
handlePlaneNormal Vector3
direction Vector3
return void
示例#1
0
        internal static Vector3 SideSlider(int id, Vector3 position, Vector3 sideVector, Vector3 direction, float size, Handles.DrawCapFunction drawFunc, float snap, float bias)
        {
            Event   current    = Event.current;
            Vector3 normalized = Vector3.Cross(sideVector, direction).normalized;
            Vector3 vector     = Handles.Slider2D(id, position, normalized, direction, sideVector, 0f, drawFunc, Vector2.one * snap);

            vector = position + Vector3.Project(vector - position, direction);
            EventType type = current.type;

            if (type != EventType.Repaint)
            {
                if (type != EventType.Layout)
                {
                    if (type == EventType.MouseMove)
                    {
                        RectHandles.DetectCursorChange(id);
                    }
                }
                else
                {
                    Vector3 normalized2 = sideVector.normalized;
                    HandleUtility.AddControl(id, HandleUtility.DistanceToLine(position + sideVector * 0.5f - normalized2 * size * 2f, position - sideVector * 0.5f + normalized2 * size * 2f) - bias);
                }
            }
            else if ((HandleUtility.nearestControl == id && GUIUtility.hotControl == 0) || GUIUtility.hotControl == id)
            {
                RectHandles.HandleDirectionalCursor(position, normalized, direction);
            }
            return(vector);
        }
示例#2
0
        internal static Vector3 SideSlider(int id, Vector3 position, Vector3 sideVector, Vector3 direction, float size, Handles.DrawCapFunction drawFunc, float snap, float bias)
        {
            Event   current     = Event.current;
            Vector3 normalized1 = Vector3.Cross(sideVector, direction).normalized;
            Vector3 vector3_1   = Handles.Slider2D(id, position, normalized1, direction, sideVector, 0.0f, drawFunc, Vector2.one * snap);
            Vector3 vector3_2   = position + Vector3.Project(vector3_1 - position, direction);

            switch (current.type)
            {
            case EventType.Repaint:
                if (HandleUtility.nearestControl == id && GUIUtility.hotControl == 0 || GUIUtility.hotControl == id)
                {
                    RectHandles.HandleDirectionalCursor(position, normalized1, direction);
                    break;
                }
                break;

            case EventType.Layout:
                Vector3 normalized2 = sideVector.normalized;
                HandleUtility.AddControl(id, HandleUtility.DistanceToLine(position + sideVector * 0.5f - normalized2 * size * 2f, position - sideVector * 0.5f + normalized2 * size * 2f) - bias);
                break;

            case EventType.MouseMove:
                RectHandles.DetectCursorChange(id);
                break;
            }
            return(vector3_2);
        }
示例#3
0
        internal static Vector3 CornerSlider(int id, Vector3 cornerPos, Vector3 handleDir, Vector3 outwardsDir1, Vector3 outwardsDir2, float handleSize, Handles.DrawCapFunction drawFunc, Vector2 snap)
        {
            Event   current = Event.current;
            Vector3 vector3 = Handles.Slider2D(id, cornerPos, handleDir, outwardsDir1, outwardsDir2, handleSize, drawFunc, snap);

            switch (current.type)
            {
            case EventType.MouseMove:
                RectHandles.DetectCursorChange(id);
                break;

            case EventType.Repaint:
                if (HandleUtility.nearestControl == id && GUIUtility.hotControl == 0 || GUIUtility.hotControl == id)
                {
                    RectHandles.HandleDirectionalCursor(cornerPos, handleDir, outwardsDir1 + outwardsDir2);
                    break;
                }
                break;
            }
            return(vector3);
        }
示例#4
0
        internal static Vector3 CornerSlider(int id, Vector3 cornerPos, Vector3 handleDir, Vector3 outwardsDir1, Vector3 outwardsDir2, float handleSize, Handles.DrawCapFunction drawFunc, Vector2 snap)
        {
            Event     current = Event.current;
            Vector3   result  = Handles.Slider2D(id, cornerPos, handleDir, outwardsDir1, outwardsDir2, handleSize, drawFunc, snap);
            EventType type    = current.type;

            if (type != EventType.MouseMove)
            {
                if (type == EventType.Repaint)
                {
                    if ((HandleUtility.nearestControl == id && GUIUtility.hotControl == 0) || GUIUtility.hotControl == id)
                    {
                        RectHandles.HandleDirectionalCursor(cornerPos, handleDir, outwardsDir1 + outwardsDir2);
                    }
                }
            }
            else
            {
                RectHandles.DetectCursorChange(id);
            }
            return(result);
        }