-
Notifications
You must be signed in to change notification settings - Fork 26
Automatically select the search field when opening a GameplayTag tree view & Keyboard shortcuts #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using UnityEditor; | ||
| using UnityEditor.IMGUI.Controls; | ||
| using UnityEngine; | ||
|
|
@@ -69,6 +70,15 @@ protected override void RowGUI(RowGUIArgs args) | |
|
|
||
| GameplayTagTreeViewItem item = args.item as GameplayTagTreeViewItem; | ||
|
|
||
|
|
||
| if (IsSelected(item.id) && Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.KeyUp) | ||
| { | ||
| m_TagNameProperty.stringValue = item.Tag.Name; | ||
| m_TagNameProperty.serializedObject.ApplyModifiedProperties(); | ||
|
|
||
| m_OnSelectionChange?.Invoke(); | ||
| } | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code block listening to the enter key to select a gameplaytag |
||
|
|
||
| if (GUI.Button(rect, s_TempContent, EditorStyles.label)) | ||
| { | ||
| m_TagNameProperty.stringValue = item.Tag.Name; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,9 @@ public GameplayTagTreeViewBase(TreeViewState treeViewState) | |
| rowHeight = 24; | ||
|
|
||
| Reload(); | ||
|
|
||
| m_SearchField.SetFocus(); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Directly set the focus on the search field when opening the dropdown to be able to search directly |
||
| m_SearchField.downOrUpArrowKeyPressed += SetFocusAndEnsureSelectedItem; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Select the first treeview item on up/down arrows |
||
| } | ||
|
|
||
| public override void OnGUI(Rect rect) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code block listening to enter key for a gameplaytag container to add/remove the tag to the container