I have a scenario where a main widget is spawning children menu widgets but first “wrapping” (as a child) them in a “container” widget. The idea is that these submenus will fade in and out and I want to re-use the same animation for all of them, so I wrap them in the “Container” before adding them to the main widget.
Hopefully that made sense. So the flow is this:
“Main” widget is created and added to viewport
“Main” widget creates a “MenuContainer” widget and “MenuOne” widget
“MenuOne” is added as a child to “MenuContainer” and “MenuContainer” is added as a child to “Containing Border”, an Overlay Panel inside the “Main” widget.
User presses the button on “MenuOne” which calls “SwitchToTwo” on the “Main” widget.
“SwitchToTwo” on the “Main” widget calls “Switch” on the “MenuContainer”. It then goes through steps 2 and 3 but with “MenuTwo”
“Switch” on the “MenuContainer” triggers an animation to fade out the widget and move it to the right over 1 second. When the animation finishes, the widget removes itself.
User presses the button on “MenuTwo” which calls “SwitchToOne” on the “Main” widget. Repeat steps 5 and 6 but with the other widget.
MenuTwo is the same as MenuOne except there’s no vertical box and only 1 line of text.
The problem occurs because MenuOne and MenuTwo are two different sizes. When transitioning from MenuOne to MenuTwo, MenuTwo is shifted to the upper-left corner while MenuOne is fading out. When MenuOne is done with the animation, MenuTwo is then corrected to the center. I want MenuTwo to start and stay in the center, regardless of any other widgets in the Overlay panel.
Here’s a video of what I’m talking about:https://youtube.com/watch?v=kZQ2rwh1DqQ
I wrapped the Main/MenuContainer/Menu# widgets in Red/Green/Blue borders to make it more clear which container is which. It seems to me like the problem is that MenuTwo is not being vertically aligned within the Main widget’s ContentContainer even though it’s set to center vertically. I don’t know how I might resolve this.
Does anyone have any potential fixes or maybe another way I could accomplish this?