Peter Bay Bastian
8 年前
当前提交
508a8634
共有 5 个文件被更改,包括 56 次插入 和 100 次删除
-
4MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphInspector.cs
-
2MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/TitleBarButtonDrawData.cs
-
48MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/HeaderDrawer.cs
-
60MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs
-
42MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/NodeExpander.cs
|
|||
using System; |
|||
using RMGUI.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.Graphing; |
|||
using UnityEngine.RMGUI; |
|||
|
|||
namespace UnityEditor.Graphing.Drawing |
|||
{ |
|||
public class NodeExpander : MouseManipulator |
|||
{ |
|||
public HeaderDrawData data; |
|||
private VisualElement initialTarget; |
|||
|
|||
public override EventPropagation HandleEvent(Event evt, VisualElement finalTarget) |
|||
{ |
|||
switch (evt.type) |
|||
{ |
|||
case EventType.MouseDown: |
|||
if (CanStartManipulation(evt)) |
|||
{ |
|||
this.TakeCapture(); |
|||
initialTarget = finalTarget; |
|||
} |
|||
break; |
|||
|
|||
case EventType.MouseUp: |
|||
if (CanStopManipulation(evt)) |
|||
{ |
|||
this.ReleaseCapture(); |
|||
var withinInitialTarget = initialTarget != null && initialTarget.ContainsPoint(evt.mousePosition); |
|||
if (withinInitialTarget) |
|||
{ |
|||
data.expanded = !data.expanded; |
|||
} |
|||
} |
|||
break; |
|||
|
|||
} |
|||
return this.HasCapture() ? EventPropagation.Stop : EventPropagation.Continue; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue