UnityEditor.RectHandles.DetectCursorChange C# (CSharp) Method

DetectCursorChange() static private method

static private DetectCursorChange ( int id ) : void
id int
return void
        internal static void DetectCursorChange(int id)
        {
            if (HandleUtility.nearestControl == id)
            {
                s_LastCursorId = id;
                Event.current.Use();
            }
            else if (s_LastCursorId == id)
            {
                s_LastCursorId = 0;
                Event.current.Use();
            }
        }

Usage Example

示例#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);
        }
All Usage Examples Of UnityEditor.RectHandles::DetectCursorChange