-
Notifications
You must be signed in to change notification settings - Fork 877
Expand file tree
/
Copy pathVFXEdgeConnector.cs
More file actions
67 lines (51 loc) · 1.76 KB
/
Copy pathVFXEdgeConnector.cs
File metadata and controls
67 lines (51 loc) · 1.76 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
59
60
61
62
63
64
65
66
67
using System.Collections.Generic;
using System.Linq;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Profiling;
using Type = System.Type;
using PositionType = UnityEngine.UIElements.Position;
namespace UnityEditor.VFX.UI
{
class VFXEdgeConnector : EdgeConnector<VFXDataEdge>
{
VFXDataAnchor m_Anchor;
public VFXEdgeConnector(VFXDataAnchor anchor) : base(anchor)
{
m_Anchor = anchor;
}
protected override void RegisterCallbacksOnTarget()
{
if (!m_Anchor.controller.isSubgraphActivation)
base.RegisterCallbacksOnTarget();
}
protected override void OnMouseMove(MouseMoveEvent e)
{
base.OnMouseMove(e);
if (!e.isPropagationStopped)
return;
VFXView view = m_Anchor.GetFirstAncestorOfType<VFXView>();
if (view == null)
return;
s_PickedList.Clear();
view.panel.PickAll(e.mousePosition, s_PickedList);
VFXDataAnchor anchor = s_PickedList.OfType<VFXDataAnchor>().FirstOrDefault();
if (anchor != null)
view.StartEdgeDragInfo(this.edgeDragHelper.draggedPort as VFXDataAnchor, anchor);
else
view.StopEdgeDragInfo();
}
protected override void OnMouseUp(MouseUpEvent e)
{
base.OnMouseUp(e);
if (!e.isPropagationStopped)
return;
VFXView view = m_Anchor.GetFirstAncestorOfType<VFXView>();
if (view == null)
return;
view.StopEdgeDragInfo();
}
static List<VisualElement> s_PickedList = new List<VisualElement>();
}
}