Godot version:
3.1 master branch
Issue description:
With the complex anchors/margins/size/position/pivot system in Godot 3.x you would think that it would be easy to set a control to be centered in its parent and keep it that way.
However if that control has to have its size changed, then the only way to keep it centered is to write additional code to 'recenter' it each time its size changes.
This also applies to designing a UI in the editor. CenterContainers don't seem to re-center the item for you when the size changes, only when the minsize changes. I don't really understand why.
What I think should be done is that when a control's size changes, it should look at the current Anchor settings and respect them. For example if the anchors corresponds to 'Top Left' then the width should increase to the right. If the anchors correspond to 'Top Right' then the width should increase to the left. If it corresponds to 'Center' then width should increase to the left and right equally Etc. It should be done like this when you're dragging to resize, when you edit the size in the inspector and when the control's size is changed in code.
See below for gif of trying to keep a control centered

Even during ui design, this is a bit irritating as when you adjust something's size you have to keep 'recentering' it.
In some ways in HTML/CSS it is actually easier to position things than this.
They are several points your question:
I tried implementing this in the pull request above and it works pretty nicely, except drag-resize ui needs to be adjusted.
Shouldn't this be handled by the Grow Direction settings?
I did try using Grow Direction but it doesn't seem to have any effect. I think Grow Direction is used only when it is in a container? Here the controls are mostly not in a container. I have no idea how Grow Direction works BTW.
I feel there are so many properties that one has to learn in 3.x's positioning/container system and it is all pretty confusing and unlike any other system I've seen. But I guess it is what it is and I just have to get used to it.
It just feels hard to get it to do what you want.
Anyways, set_size as currently implemented in master does not look at Grow Direction. It always adds size to right and bottom. My pull request above adds size to left/right/top/bottom in the correct ratio according to the anchor settings.
Most helpful comment
I did try using Grow Direction but it doesn't seem to have any effect. I think Grow Direction is used only when it is in a container? Here the controls are mostly not in a container. I have no idea how Grow Direction works BTW.
I feel there are so many properties that one has to learn in 3.x's positioning/container system and it is all pretty confusing and unlike any other system I've seen. But I guess it is what it is and I just have to get used to it.
It just feels hard to get it to do what you want.
Anyways,
set_sizeas currently implemented in master does not look at Grow Direction. It always adds size to right and bottom. My pull request above adds size to left/right/top/bottom in the correct ratio according to the anchor settings.