-
-
Notifications
You must be signed in to change notification settings - Fork 22.5k
Editor: Add highlight around docks when dragging #106762
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: master
Are you sure you want to change the base?
Conversation
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.
Tested locally, it works as expected. This is a nice usability improvement 🙂
My only concern is that the width of the drag border hint is a bit too wide by default. It also varies depending on the editor spacing preset chosen, and it'll be invisible with the Compact spacing preset:
Default
Spacious
Compact
I suggest using a fixed value that's identical to the standard focus outline (Math::round(2 * EDSCALE)
).
Thanks for the tips! I changed the width to a constant, and removed the |
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.
Thanks for the tip on |
There were a few visual changes, primarily that the dragging hints will only be shown when hoverred on, and the visual side of the rect is now fit to the TabContainer, but the interaction is not. The clip shows an example of this: Screen.Recording.2025-05-28.at.10.45.16.AM.mov |
editor/editor_dock_manager.cpp
Outdated
int dock_hidden_size = 28 * EDSCALE; | ||
int dock_hidden_offset = dock_hidden_size + 4 * EDSCALE; | ||
Rect2 temp_dock_drag_rects[DOCK_SLOT_MAX]; | ||
temp_dock_drag_rects[DOCK_SLOT_LEFT_UL] = dock_slot[DOCK_SLOT_LEFT_UL]->get_global_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.
This can just cover the contents, so the TabContainer drag and drop logic works the same as before, and dropping it on the contents just adds it to the end.
dock_slot[i]->get_current_tab_control()->get_global_rect();
.
And this logic to set the rects should be from EditorDockManager's drag begin notification, so it only happens once instead of for each one.
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.
Unfortunately since EditorDockManager
is an Object and not in the tree, it does not receive the drag notification. However, I already have safeguards against computing the information multiple times, it stores the output and has an early return if the output is already known for the current drag.
Although if I limit the drop rect to the child control, then the highlight won't appear when the mouse is over the tabbar unless I returned to using input()
. What do you think about this?
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.
If it doesn't get the notification, then it is fine. In the future we may want to move some dock management into a Control.
I think it's fine to not highlight when the mouse is over the TabBar, since it has its own drop highlight and it allows moving the tab to a different index.
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.
Actually thinking about it, I do think that we should override the TabBar drag and dropping. If we want to limit where the dock can be dropped (ie for different horizontal / vertical layouts), we need to change the behavior somewhat, and I think that this is the place. I might try and see if I can somehow update the TabBar's drop hint.
It should be back to the original design from a user standpoint, but with a control as the backend, cleaning up the implementation a lot. There's a few changes that should be made once the EditorDock PR is merged, but until then it is good. |
c5230a7
to
cf45af4
Compare
1091da8
to
5899cd0
Compare
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.
Works as expected.
Can be improved in the future with dragging to closed slots, and _get_dock_tab_dragged
logic can be simplified with some kind of Dock manager control.
9c0f5ca
to
b86e0dc
Compare
Closes godotengine/godot-proposals#12489
Adds a highlight around docks when dragging that tells you whether you can drop a dock. Also increases the area to drop docks to the entire TabContainer.
Screen.Recording.2025-05-23.at.2.51.05.PM.mov
This PR also creates the EditorDockDragHint node to contain the logic.