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

Fixed formatting

This commit is contained in:
Thor Brigsted 2019-09-04 17:25:20 +02:00
parent 8c26042eef
commit 3b6135cde7
2 changed files with 11 additions and 15 deletions

View File

@ -499,13 +499,9 @@ namespace XNodeEditor {
NodeEditorGUILayout.DrawPortHandle(rect, bgcol, frcol); NodeEditorGUILayout.DrawPortHandle(rect, bgcol, frcol);
} }
stoppedDraggingPort = true; stoppedDraggingPort = true;
} } else {
else if (stoppedDraggingPort) {
{ if (draggedPort != null && draggedPort.IsOutput) {
if(stoppedDraggingPort)
{
if(draggedPort != null && draggedPort.IsOutput)
{
GenericMenu menu = new GenericMenu(); GenericMenu menu = new GenericMenu();
graphEditor.AddContextMenuItems(menu, ConnectOnCreate); graphEditor.AddContextMenuItems(menu, ConnectOnCreate);
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero)); menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
@ -515,10 +511,10 @@ namespace XNodeEditor {
} }
if (hoveredPort != null) if (hoveredPort != null)
draggedPort = hoveredPort; draggedPort = hoveredPort;
else if(draggedOutputTarget != null) else if (draggedOutputTarget != null)
draggedPort = draggedOutputTarget; draggedPort = draggedOutputTarget;
Repaint(); Repaint();
} }
bool IsHoveringTitle(XNode.Node node) { bool IsHoveringTitle(XNode.Node node) {
@ -532,12 +528,12 @@ namespace XNodeEditor {
Rect windowRect = new Rect(nodePos, new Vector2(width / zoom, 30 / zoom)); Rect windowRect = new Rect(nodePos, new Vector2(width / zoom, 30 / zoom));
return windowRect.Contains(mousePos); return windowRect.Contains(mousePos);
} }
private void ConnectOnCreate(object obj = default(object))
{ private void ConnectOnCreate(object obj = default(object)) {
if(graph.nodes.Last().Ports.Where(r => r.IsInput == true).Any(r => r.ValueType == draggedPort.ValueType)) if (graph.nodes.Last().Ports.Where(r => r.IsInput == true).Any(r => r.ValueType == draggedPort.ValueType))
draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).Where(r => r.ValueType == draggedPort.ValueType).ToArray()[0]); draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).Where(r => r.ValueType == draggedPort.ValueType).ToArray() [0]);
else else
draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).ToArray()[0]); draggedPort.Connect(graph.nodes.Last().Ports.Where(r => r.IsInput == true).ToArray() [0]);
} }
} }
} }

View File

@ -51,7 +51,7 @@ namespace XNodeEditor {
string path = GetNodeMenuName(type); string path = GetNodeMenuName(type);
if (string.IsNullOrEmpty(path)) continue; if (string.IsNullOrEmpty(path)) continue;
if(call != null) if (call != null)
menu.AddItem(new GUIContent(path), false, () => { menu.AddItem(new GUIContent(path), false, () => {
CreateNode(type, pos); CreateNode(type, pos);
call(null); call(null);