Closed chaigler closed 8 years ago
I'm confused as to what you're expecting as the horizSizing
and vertSizing
fields specify how the control behaves when its parent control is resized. That's their only purpose.
@dottools After some additional testing, I've edited the issue to clarify the problem. To be clear, the sizing options work, except on controls added to existing UIs via addGuiControl().
In a typical use case where you're loading a complete GUI from a file, UI controls reposition/resize themselves as they're pushed to the Canvas and call parentResized() on all of their children. Adding a control directly via addGuiControl() (to a GUI that has been added to the Canvas at any point) skips this step because its parent container has already been resized so parentResized() never gets called.
It's an edge case but it breaks the sizing options.
After some additional review, I'm not sure this can be correctly classified as a bug. All of the sizing options work as expected assuming you position/scale UI controls according to your GUI's initial 'design resolution'. In my case, I had a control positioned at (0, 0) with horizSizing = "center". I expected the control to be centered automatically on creation but @dottools is correct, that's not really their intended function.
Think I'll close this one. :]
When adding a UI control to an existing GUI via addGuiControl(), the child UI's size & position will not be properly updated until its parent container is resized. Instead, the child control will be sized and positioned using the values assigned to its "size" and "position" fields. Once its parent container is resized, the child control will be immediately repositioned/resized according to its horizSizing/vertSizing fields.