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

Scaling HBoxContainer children results in loss of alignment #38356

Closed
tavurth opened this issue Apr 30, 2020 · 6 comments
Closed

Scaling HBoxContainer children results in loss of alignment #38356

tavurth opened this issue Apr 30, 2020 · 6 comments
Labels

Comments

@tavurth
Copy link
Contributor

tavurth commented Apr 30, 2020

Godot version:
Screenshot 2020-04-30 at 16 51 04

OS/device including version:
Screenshot 2020-04-30 at 16 52 32

Issue description:
When scaling a child of HBoxContainer, the item no longer matches the HBox alignment.

Steps to reproduce:

  1. Create a HBoxContainer
  2. Set the layout to Top Wide
  3. Add a child MenuButton
  4. Scale the MenuButton rect rect.scale to (0.1, 0.1)

The MenuButton will now be half way across the HBoxContainer

Other information
Screenshot 2020-04-30 at 16 54 42

@YuriSizov
Copy link
Contributor

From what I can see, the rect_scale property on the MenuButton in this case is not editable and resets if you toggle visibility. Alignment is also displayed correctly after the toggling.

@groud
Copy link
Member

groud commented Apr 30, 2020

This is the expected behavior. Children of containers get their size and position (which are proxies of the margins values), overridden by the container itself. Changing those values should not be done and might lead to unexpected behaviors.

I think there is already a PR somewhere to fix that by disabling the edit of those properties, but I could not find it.

@groud groud closed this as completed Apr 30, 2020
@groud groud added the archived label Apr 30, 2020
@YuriSizov
Copy link
Contributor

Here it is: #30623

@groud
Copy link
Member

groud commented Apr 30, 2020

Exactly, thanks ! :)

@groud
Copy link
Member

groud commented Apr 30, 2020

Oh, in fact I just realized that I am probably wrong. rect_scale is not rect_size and thus is not overridden by the parent container.

But this make this issue a duplicate of #19068.

@tavurth
Copy link
Contributor Author

tavurth commented Apr 30, 2020

Thanks guys!

Glad to know it's not a bug. It had me confused for a while so I'm glad there's a PR to prevent editing of the properties.

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

No branches or pull requests

3 participants