diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs
index f562d72..b237d6b 100644
--- a/Scripts/Editor/NodeEditorAction.cs
+++ b/Scripts/Editor/NodeEditorAction.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using UnityEditor;
using UnityEngine;
@@ -303,6 +304,12 @@ namespace XNodeEditor {
/// Remove nodes in the graph in Selection.objects
public void RemoveSelectedNodes() {
+ // We need to delete reroutes starting at the highest point index to avoid shifting indices
+ selectedReroutes = selectedReroutes.OrderByDescending(x => x.pointIndex).ToList();
+ for (int i = 0; i < selectedReroutes.Count; i++) {
+ selectedReroutes[i].RemovePoint();
+ }
+ selectedReroutes.Clear();
foreach (UnityEngine.Object item in Selection.objects) {
if (item is XNode.Node) {
XNode.Node node = item as XNode.Node;
diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs
index 629bc9d..2c71a29 100644
--- a/Scripts/Editor/NodeEditorGUI.cs
+++ b/Scripts/Editor/NodeEditorGUI.cs
@@ -216,6 +216,7 @@ namespace XNodeEditor {
List selection = preBoxSelectionReroute != null ? new List(preBoxSelectionReroute) : new List();
hoveredReroute = new RerouteReference();
+ Color col = GUI.color;
foreach (XNode.Node node in graph.nodes) {
//If a null node is found, return. This can happen if the nodes associated script is deleted. It is currently not possible in Unity to delete a null asset.
if (node == null) continue;
@@ -249,21 +250,28 @@ namespace XNodeEditor {
// Loop through reroute points again and draw the points
for (int i = 0; i < reroutePoints.Count; i++) {
+ RerouteReference rerouteRef = new RerouteReference(output, k, i);
// Draw reroute point at position
- Rect rect = new Rect(reroutePoints[i], new Vector2(16, 16));
- rect.position = new Vector2(rect.position.x - 8, rect.position.y - 8);
+ Rect rect = new Rect(reroutePoints[i], new Vector2(12, 12));
+ rect.position = new Vector2(rect.position.x - 6, rect.position.y - 6);
rect = GridToWindowRect(rect);
- Color bgcol = new Color32(90, 97, 105, 255);;
- if (selectedReroutes.Contains(new RerouteReference(output, k, i))) bgcol = Color.yellow;
- NodeEditorGUILayout.DrawPortHandle(rect, bgcol, connectionColor);
- if (rect.Overlaps(selectionBox)) selection.Add(new RerouteReference(output, k, i));
- if (rect.Contains(mousePos)) hoveredReroute = new RerouteReference(output, k, i);
+ // Draw selected reroute points with an outline
+ if (selectedReroutes.Contains(rerouteRef)) {
+ GUI.color = NodeEditorPreferences.GetSettings().highlightColor;
+ GUI.DrawTexture(rect, NodeEditorResources.dotOuter);
+ }
+
+ GUI.color = connectionColor;
+ GUI.DrawTexture(rect, NodeEditorResources.dot);
+ if (rect.Overlaps(selectionBox)) selection.Add(rerouteRef);
+ if (rect.Contains(mousePos)) hoveredReroute = rerouteRef;
}
}
}
}
+ GUI.color = col;
if (Event.current.type != EventType.Layout && currentActivity == NodeActivity.DragGrid) selectedReroutes = selection;
}