mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Set focus to input TextField by default
Content preselected, same as rename behaviour in Unity
This commit is contained in:
parent
b54ff48690
commit
656196005c
@ -4,6 +4,8 @@ using UnityEngine;
|
||||
namespace XNodeEditor {
|
||||
/// <summary> Utility for renaming assets </summary>
|
||||
public class RenamePopup : EditorWindow {
|
||||
private const string inputControlName = "nameInput";
|
||||
|
||||
public static RenamePopup current { get; private set; }
|
||||
public Object target;
|
||||
public string input;
|
||||
@ -42,7 +44,9 @@ namespace XNodeEditor {
|
||||
UpdatePositionToMouse();
|
||||
firstFrame = false;
|
||||
}
|
||||
GUI.SetNextControlName(inputControlName);
|
||||
input = EditorGUILayout.TextField(input);
|
||||
EditorGUI.FocusTextInControl(inputControlName);
|
||||
Event e = Event.current;
|
||||
// If input is empty, revert name to default instead
|
||||
if (input == null || input.Trim() == "") {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user