mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Improved layout of float and int fields
This commit is contained in:
parent
147424ca73
commit
e502e23b50
@ -107,7 +107,11 @@ public class NodeEditor {
|
|||||||
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
if (fieldType == typeof(int)) {
|
if (fieldType == typeof(int)) {
|
||||||
fieldValue = EditorGUILayout.IntField(fieldPrettyName, (int)fieldValue);
|
Rect rect = EditorGUILayout.GetControlRect();
|
||||||
|
rect.width *= 0.5f;
|
||||||
|
EditorGUI.LabelField(rect, fieldPrettyName);
|
||||||
|
rect.x += rect.width;
|
||||||
|
fieldValue = EditorGUI.IntField(rect, (int)fieldValue);
|
||||||
}
|
}
|
||||||
else if (fieldType == typeof(bool)) {
|
else if (fieldType == typeof(bool)) {
|
||||||
fieldValue = EditorGUILayout.Toggle(fieldPrettyName, (bool)fieldValue);
|
fieldValue = EditorGUILayout.Toggle(fieldPrettyName, (bool)fieldValue);
|
||||||
@ -134,7 +138,11 @@ public class NodeEditor {
|
|||||||
fieldValue = EditorGUILayout.RectField(fieldPrettyName, (Rect)fieldValue);
|
fieldValue = EditorGUILayout.RectField(fieldPrettyName, (Rect)fieldValue);
|
||||||
}
|
}
|
||||||
else if (fieldType == typeof(float)) {
|
else if (fieldType == typeof(float)) {
|
||||||
fieldValue = EditorGUILayout.FloatField(fieldPrettyName, (float)fieldValue);
|
Rect rect = EditorGUILayout.GetControlRect();
|
||||||
|
rect.width *= 0.5f;
|
||||||
|
EditorGUI.LabelField(rect, fieldPrettyName);
|
||||||
|
rect.x += rect.width;
|
||||||
|
fieldValue = EditorGUI.FloatField(rect, (float)fieldValue);
|
||||||
}
|
}
|
||||||
else if (fieldType == typeof(Vector2)) {
|
else if (fieldType == typeof(Vector2)) {
|
||||||
fieldValue = EditorGUILayout.Vector2Field(fieldPrettyName, (Vector2)fieldValue);
|
fieldValue = EditorGUILayout.Vector2Field(fieldPrettyName, (Vector2)fieldValue);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user