godotengine / godotengine/godot
centerContainer anchor preset doesn't actually center the first time you select the center option
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in: Godot_v4.2.2-stable_win64
### System information
Windows 11 - Godot v4.2.2.stable - Forward+ - dedicated
### Issue description
Adding a centerContainer to a Control Node as a child and then setting centerContainer's layout mode to Anchors and Anchors Preset to Center will not fully center the layout. The control node is the child of another node as well.
### Steps to reproduce
1. Add a Control Node as a child of another node.
2. Add a centerContainer as a child of the Control node.
3. Set Control node anchor preset to full rect
4. set centerContainer layout mode to anchors
5. set centerContainer anchors preset to center.
You will then see that centerContainer is not actually center and the way to fix this is to select its anchors preset and set it to H Center Wide and then set it back to center
### Minimal reproduction project (MRP)
[main.zip](https://github.com/user-attachments/files/17166694/main.zip)
Contributor guide
Research direction
Open the linked main.zip minimal reproduction in Godot v4.2.2 on Windows and follow the listed Control and CenterContainer anchor steps. Compare the initial Center preset with the H Center Wide then Center workaround, and trace the editor's anchor-preset handling until the first selection produces the same centered result.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100