Replies: 2 comments 2 replies
-
No, they don't. Anchors and Margins are relative to the parent. And if you mean containers, they bypass that entirely and go for Rect Position and Size.
No, it is not a copy. Anchors and Margins tell the Control how to change Rect Position and Size when the parent Control resizes (and it is not a Container).
If the parent is a Container, you are looking for Size Flags. Otherwise Anchors and Margins is what you want.
You don't have to, no. You can edit Anchors and Margins. Although, a MarginContainer might be easier to use since the usage of Anchors and Margins isn't communicated well. However…
Right. Once you are placing the controls inside a container (ScrollContainer in this case) then Anchors and Margins are out of the window. So MarginContainer is the only option.
You can animate Rect Position directly. And when I say animate, I mean with a Tween or an AnimationPlayer. And you don't even have to make an animation for every button, instead you can change the Root Node of an AnimationPlayer to have the animation apply to a different Node. And be gland you can because in Godot 4 - thanks to #2841 - they are hidden when the Control is in a Container, so you can't make a track in the AnimatorPlayer.
I would prefer something closer to WInForms. But, yes, there is room for improvement. |
Beta Was this translation helpful? Give feedback.
-
It appears that things would be better if we didn't need MarginContainer, PanelContainer and ScrollContainer. And there is a way to do it: to the Anchors and Margins computation add position offsets given by the parent node.
The way I'm thinking it, there is a top, bottom, left and right offset. And how much of each is used is controlled by the Anchor of the children Node. The drawback is, of course, that we would be making the computation more complex for every Control, not just those that use it. Yet, it might be worth it. |
Beta Was this translation helpful? Give feedback.
-
For now, Anchors and Margins are just variables that you should never touch, because they are changed by parent control nodes;
They are also are obsolete, as they are just a copy to the Rect Position & Size system;
On the other hand, right now we miss a system of variables that could edit how Control Node behaves in parent Control Nodes.
It doesn't make any sens to me, that every node has Margin variable, but to actually add margin to a node I have to add MarginContainer node between every single control node and it's child.
For example, to add ScrollContainer, right now you have to add ScrollContainer, than add MarginContainer to it, and than add VBoxContainer to MarginContainer, and like this every single time.
Not even mentioning how tedious it is now to animate movement of nodes, i.e. adding button sliding in from the left, but still having it as a part of VBoxContainer.
In my opinion we really lack something like CSS padding, margin & anchor system.
Beta Was this translation helpful? Give feedback.
All reactions