TheCherno / Hazel

Hazel Engine
Apache License 2.0
11.64k stars 1.5k forks source link

Sets focus to the entity's tag text field after a double-click on it … #581

Closed rflgf closed 1 year ago

rflgf commented 2 years ago

…from Scene Hierarchy Panel

Describe the issue (if no issue has been made)

Not really much of an issue, just a convention that I believe most GUIs follow and that could be added to Hazelnut as well.

PR impact

Impact Issue/PR
Issues this solves None
Other PRs this solves None

Proposed fix

Quality of life improvement feature to Hazelnut. After the user double-clicks on an entity's tag from the Scene Hierarchy Panel, its text input is automatically set on focus. Two details to give special attention: a global bool g_DoubleClick was created for this, which could easily be transformed into a member variable of SceneHierarchyPanel. I'm not sure which is preferable but I volunteer to make the adaptation if necessary; second detail is, I couldn't get it to only select the entire text if it was double-clicked from the scene hierarchy panel, my solution was quite buggy, so I just made it so interacting with the tag text input always selects everything, which may be undesirable as well. This behavior is also demonstrated in the capture below.

https://user-images.githubusercontent.com/51202489/188043421-707786b4-c0b6-443d-a453-491f3bcd0617.mp4

rflgf commented 1 year ago

I'll be closing this PR since after having reflected on it for a while I figured this implementation adds more complexity to the code base than the feature is worth this early in the series.