godot
godot copied to clipboard
Allow ScrollContainer to be clicked for focus and border
The SceneTree and FileSystem docks have focus borders automatically since TreeDialog is one of the few classes which provides this, and also offer focus-on-click. In my opinion the style of this works well with Godot and is potentially useful for checking what the user is currently doing - for example, if they are editing the SceneTree then that dock has focus.
In order to make the Inspector dock more consistent with this style, since it has a similar feel and context anyway, I have made it (a) clickable and (b) draw the same border when focused. This is a really useful feature for another PR I'm making soon which needs to recognise what dock the user is working in, but it certainly has other use cases (e.g. for plugins) as well and just looks nice.
Problems:
- ~~The border-focus stylebox is drawn underneath elements such as text boxes. I don't know if this matters, but it's something that could be fixed if necessary.~~ This has now been fixed by using a more general and standard method for drawing the focus stylebox.
- ~~When doing something like dragging a slider immediately after something else was focused, focus returns to that area and not the Inspector. This probably doesn't matter though and, again, could be fixed.~~ This still occurs but is no longer a problem, since recent updates have made focus changes more stable.
Update 2022-09-01: additionally, the focus border has been made available in ScrollContainer as a whole.