forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathButton.cs
More file actions
58 lines (58 loc) · 1.38 KB
/
Copy pathButton.cs
File metadata and controls
58 lines (58 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using UnityEditor;
using UnityEngine;
namespace UnityEditorInternal
{
internal class Button
{
public static bool Do(int id, Vector3 position, Quaternion direction, float size, float pickSize, Handles.DrawCapFunction capFunc)
{
Event current = Event.current;
switch (current.GetTypeForControl(id))
{
case EventType.MouseDown:
if (HandleUtility.nearestControl == id)
{
GUIUtility.hotControl = id;
current.Use();
}
break;
case EventType.MouseUp:
if (GUIUtility.hotControl == id && (current.button == 0 || current.button == 2))
{
GUIUtility.hotControl = 0;
current.Use();
if (HandleUtility.nearestControl == id)
{
return true;
}
}
break;
case EventType.MouseMove:
if ((HandleUtility.nearestControl == id && current.button == 0) || (GUIUtility.keyboardControl == id && current.button == 2))
{
HandleUtility.Repaint();
}
break;
case EventType.Repaint:
{
Color color = Handles.color;
if (HandleUtility.nearestControl == id && GUI.enabled)
{
Handles.color = Handles.selectedColor;
}
capFunc(id, position, direction, size);
Handles.color = color;
break;
}
case EventType.Layout:
if (GUI.enabled)
{
HandleUtility.AddControl(id, HandleUtility.DistanceToCircle(position, pickSize));
}
break;
}
return false;
}
}
}