1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

Allow to trigger renames via F2 key

This commit is contained in:
Thomas Morgner 2018-11-16 12:14:04 +00:00
parent 35861d20c6
commit b138388c29

View File

@ -31,8 +31,19 @@ namespace XNodeEditor {
}
} else {
GUILayout.Label(title, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
if (HasFocus() && IsRenameKeyPressed()) {
InitiateRename();
}
}
}
bool HasFocus() {
return Selection.activeObject == this.target;
}
bool IsRenameKeyPressed() {
return (Event.current != null && Event.current.isKey && Event.current.keyCode == KeyCode.F2);
}
/// <summary> Draws standard field editors for all public fields </summary>
public virtual void OnBodyGUI() {