diff --git a/Scripts/Editor/NodeEditorAction.cs b/Scripts/Editor/NodeEditorAction.cs
index 6e5e035..41bb196 100644
--- a/Scripts/Editor/NodeEditorAction.cs
+++ b/Scripts/Editor/NodeEditorAction.cs
@@ -46,7 +46,7 @@ namespace XNodeEditor {
if (Selection.objects[i] is XNode.Node) {
XNode.Node node = Selection.objects[i] as XNode.Node;
node.position = WindowToGridPosition(e.mousePosition) + dragOffset[i];
- if (NodeEditorPreferences.gridSnap) {
+ if (NodeEditorPreferences.GridSnap) {
node.position.x = (Mathf.Round((node.position.x + 8) / 16) * 16) - 8;
node.position.y = (Mathf.Round((node.position.y + 8) / 16) * 16) - 8;
}
diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs
index 32232f0..fc28784 100644
--- a/Scripts/Editor/NodeEditorGUI.cs
+++ b/Scripts/Editor/NodeEditorGUI.cs
@@ -240,7 +240,7 @@ namespace XNodeEditor {
style.padding = new RectOffset();
GUI.color = nodeEditor.GetTint();
GUILayout.BeginVertical(new GUIStyle(style));
- GUI.color = Color.white;
+ GUI.color = NodeEditorPreferences.HighlightColor;
GUILayout.BeginVertical(new GUIStyle(highlightStyle));
} else {
GUIStyle style = NodeEditorResources.styles.nodeBody;
diff --git a/Scripts/Editor/NodeEditorPreferences.cs b/Scripts/Editor/NodeEditorPreferences.cs
index a34d678..0df1ad2 100644
--- a/Scripts/Editor/NodeEditorPreferences.cs
+++ b/Scripts/Editor/NodeEditorPreferences.cs
@@ -23,8 +23,8 @@ namespace XNodeEditor {
}
private static Texture2D _crossTexture;
- /// TypeColors requested by the editor
- public static bool gridSnap { get { VerifyLoaded(); return settings.gridSnap; } }
+ public static bool GridSnap { get { VerifyLoaded(); return settings.gridSnap; } }
+ public static Color HighlightColor { get { VerifyLoaded(); return settings.highlightColor; } }
private static Dictionary typeColors = new Dictionary();
private static Settings settings;
@@ -33,6 +33,7 @@ namespace XNodeEditor {
private class Settings : ISerializationCallbackReceiver {
public Color32 gridLineColor = new Color(0.45f, 0.45f, 0.45f);
public Color32 gridBgColor = new Color(0.18f, 0.18f, 0.18f);
+ public Color32 highlightColor = new Color32(255, 223, 255, 255);
public bool gridSnap = true;
public string typeColorsData = "";
public Dictionary typeColors = new Dictionary();
@@ -62,6 +63,7 @@ namespace XNodeEditor {
private static void PreferencesGUI() {
VerifyLoaded();
+ NodeSettingsGUI();
GridSettingsGUI();
TypeColorsGUI();
if (GUILayout.Button(new GUIContent("Set Default", "Reset all values to default"), GUILayout.Width(120))) {
@@ -85,9 +87,20 @@ namespace XNodeEditor {
EditorGUILayout.Space();
}
+ private static void NodeSettingsGUI() {
+ //Label
+ EditorGUILayout.LabelField("Node", EditorStyles.boldLabel);
+ settings.highlightColor = EditorGUILayout.ColorField("Selection", settings.highlightColor);
+ if (GUI.changed) {
+ SavePrefs();
+ NodeEditorWindow.RepaintAll();
+ }
+ EditorGUILayout.Space();
+ }
+
private static void TypeColorsGUI() {
//Label
- EditorGUILayout.LabelField("Type colors", EditorStyles.boldLabel);
+ EditorGUILayout.LabelField("Types", EditorStyles.boldLabel);
//Display type colors. Save them if they are edited by the user
List keys = new List(typeColors.Keys);