-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Sort single clicked UI element by z-index #96584
base: master
Are you sure you want to change the base?
Conversation
0b757ad
to
82ab015
Compare
As mentioned in #96576 (comment), this won't make selecting work according to the rendering order in the general case. But as a band-aid fix for simple use case I guess it makes sense to select specifically according to the z-index. While at this, note that after #68070 every CanvasItem has z-index, not only Node2Ds like before. So godot/editor/plugins/canvas_item_editor_plugin.h Lines 266 to 273 in b6223c0
Also here godot/editor/plugins/canvas_item_editor_plugin.cpp Lines 642 to 646 in b6223c0
godot/scene/main/canvas_item.cpp Lines 584 to 599 in b6223c0
|
Yeah, I saw that regarding I have not played around enough in the 2D part of the engine to know the other details. But from my understanding, the editor UI is simply clicking at a location, checking within a rect and grabbing all bottom-level nodes (non parents). Before we were just grabbing the 0th item off of that array - but it sounds like we need a general sorting algorithm that deals with |
Edit: this is just a bandaid solution and the change (although helpful) needs to be weighed against the risk of putting things in the codebase that don't fix the full issue.
Fixes #96576
Small change, just need to sort the single-item selection possibilities by z-index before grabbing the 0th element.