Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some containers don't respect size flags #47559

Open
Shadowblitz16 opened this issue Apr 2, 2021 · 5 comments
Open

Some containers don't respect size flags #47559

Shadowblitz16 opened this issue Apr 2, 2021 · 5 comments

Comments

@Shadowblitz16
Copy link

Godot version:

3.2.3

OS/device including version:

Kubuntu 20.10 64bit

Issue description:

I have found that alot of containers do not respect controls size flags.

Most people just pass it off as design but I disagree.
When I think of expand I think a flag that makes the control take up as much space as it needs...
When I think of fill I think a flag that makes the control take up as much space as it can...
When I think of min size I think of the minimum size of that control without size flags.(size flags should override sizes greater)

image
As you can see my value label does not fill the space needed even though...
HBoxContainer has both expand and fill for both x and y,
Name has expand for x and fill for x and y,
Value has both expand and fill for both x and y.

messing with these doesn't affect the center container at all because it doesn't take in account it's children's calculated size.

Steps to reproduce:

  • Download the project
  • Load it in godot
  • Open Menu.tscn
  • Open scenes/controls/option.tcsn
  • Try to get Value to take up as much room as possible while Name only takes up as much as it needs

Minimal reproduction project:
Asteroids.zip

@YuriSizov
Copy link
Contributor

I don’t know why exactly CenterContainer doesn’t allow expand, but if it did, it would be no different from MarginContainer. If you use MarginContainer with shrink center for vertical flags, you will get the result you were looking for.

So I guess, yes, it is the design of CenterContainer to absolutely always center its content.

@smix8
Copy link
Contributor

smix8 commented Apr 2, 2021

If you can't restrict child controls with expand flags with the size constraints of their parent containers most complex ui layouts would completely explode if screen sizes and layouts are changed.

I think CenterContainer is the only Container type that ignores the expand flags of child controls completely and only works if you set a minimum size for the children. At least I never had this behaviour with other control container types. Others container controls always allow child controls to use all available space within the container control constraints.

On the other hand I can't think of a valid point for the existence of the CenterContainer node if it would always stretch to children with expand flags set. It would just do the same as setting anchor points.

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented Apr 3, 2021

@SmiX

If you can't restrict child controls with expand flags with the size constraints of their parent containers most complex ui layouts would completely explode if screen sizes and layouts are changed.

I'm not restricting child controls with expand flags. I want the controls to resize based on its children/content not its parent

I think CenterContainer is the only Container type that ignores the expand flags of child controls completely and only works if you set a minimum size for the children. At least I never had this behaviour with other control container types. Others container controls always allow child controls to use all available space within the container control constraints.

Minimum size should be a minimum hard limitation of that control.
If a control set to expand it should calculate its size based on it's children or content. (for example a label expanding to the text it contains)

On the other hand I can't think of a valid point for the existence of the CenterContainer node if it would always stretch to children with expand flags set. It would just do the same as setting anchor points.

Wtf point is a control if makes the controls in them a size of 0,0?

@pycbouh

I don’t know why exactly CenterContainer doesn’t allow expand, but if it did, it would be no different from MarginContainer. If you use MarginContainer with shrink center for vertical flags, you will get the result you were looking for.

So I guess, yes, it is the design of CenterContainer to absolutely always center its content

I don't see what the point in having two controls do the same thing then.
when I think of a center container I think of a container that centers it's children.
I don't think of a container that also shrinks its children to minimum size regardless of what their actual size might be

@smix8
Copy link
Contributor

smix8 commented Apr 4, 2021

I want the controls to resize based on its children/content not its parent

If a control set to expand it should calculate its size based on it's children or content.

Control "expand" flag is not expand in the sense "use just as much space as you need" but more "flood fill and use all space that you can grab from other controls without an expand flag inside your parent container" so the only workable way to restrict child controls with expand flags from taking up the entire screen is their parent container size. Minimum size already works as a hard minimum limit for control sizes.

Wtf point is a control if makes the controls in them a size of 0,0?

To place the child control at the very center but it also requires to give the control a minimum size or else it turns to 0,0. Not optimal but that is how it currently works.

@Shadowblitz16
Copy link
Author

I want the controls to resize based on its children/content not its parent

If a control set to expand it should calculate its size based on it's children or content.

Control "expand" flag is not expand in the sense "use just as much space as you need" but more "flood fill and use all space that you can grab from other controls without an expand flag inside your parent container" so the only workable way to restrict child controls with expand flags from taking up the entire screen is their parent container size. Minimum size already works as a hard minimum limit for control sizes.

yes i know but thats what I am saying its not doing that.

Wtf point is a control if makes the controls in them a size of 0,0?

To place the child control at the very center but it also requires to give the control a minimum size or else it turns to 0,0. Not optimal but that is how it currently works.
it should not be set to 0,0 at all it should be set to minimum size + whatever size flags are enabled for the containers children

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants