1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

!B 端口连接后,没有释放连接线

This commit is contained in:
Icarus 2019-11-26 18:53:25 +08:00
parent 1691e4ce21
commit 2b21b0ddc6

View File

@ -222,17 +222,13 @@ namespace XNodeEditor {
MenuPopupWindow menu = new MenuPopupWindow(); MenuPopupWindow menu = new MenuPopupWindow();
graphEditor.AddContextMenuItems(menu); graphEditor.AddContextMenuItems(menu);
menu.OnCloseA += () => menu.OnCloseA += _releaseDraggedConnection;
{
//Release dragged connection
draggedOutput = null;
draggedOutputTarget = null;
EditorUtility.SetDirty(graph);
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
};
PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),menu); PopupWindow.Show(new Rect(Event.current.mousePosition, Vector2.zero),menu);
} }
_releaseDraggedConnection();
} else if (currentActivity == NodeActivity.DragNode) { } else if (currentActivity == NodeActivity.DragNode) {
IEnumerable<XNode.Node> nodes = Selection.objects.Where(x => x is XNode.Node).Select(x => x as XNode.Node); IEnumerable<XNode.Node> nodes = Selection.objects.Where(x => x is XNode.Node).Select(x => x as XNode.Node);
foreach (XNode.Node node in nodes) EditorUtility.SetDirty(node); foreach (XNode.Node node in nodes) EditorUtility.SetDirty(node);
@ -346,6 +342,15 @@ namespace XNodeEditor {
} }
} }
private void _releaseDraggedConnection()
{
//Release dragged connection
draggedOutput = null;
draggedOutputTarget = null;
EditorUtility.SetDirty(graph);
if (NodeEditorPreferences.GetSettings().autoSave) AssetDatabase.SaveAssets();
}
private void RecalculateDragOffsets(Event current) { private void RecalculateDragOffsets(Event current) {
dragOffset = new Vector2[Selection.objects.Length + selectedReroutes.Count]; dragOffset = new Vector2[Selection.objects.Length + selectedReroutes.Count];
// Selected nodes // Selected nodes