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

Better handling of StackPanel layout warning #14549

Merged
merged 8 commits into from Dec 1, 2023

Conversation

carolhmj
Copy link
Contributor

Related forum issue: https://forum.babylonjs.com/t/control-is-using-height-in-percentage-mode-inside-a-vertical-stackpanel-warnings-after-update-to-6-25-0/45071

This PR tries to make more consistent the handling of cases where to display a warning about sizes inside a StackPanel. The main reason this warning should be displayed is in cases where it is not possible to determine the sizes of all controls inside the StackPanel by using just the controls themselves and their children. I'm calling "fully defined" the width/height of controls that can be determined using just the size of the control and its children - i.e, the control doesn't depend on its parent for sizing. A regular Control would be fully defined if its size is expressed in pixels instead of percentage. And a Container control would be fully defined if it has adaptWidth/HeightToChildren set to true and all its children are fully defined. For a StackPanel, we want its width (in horizontal mode) or height (in vertical mode) to be fully defined, because they adapt to their children. So we display the warning when the corresponding dimension is not fully defined. I didn't reword the warning itself because I couldn't think of a better phrasing, but it might be good to change the phrasing too.

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 27, 2023

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 27, 2023

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 27, 2023

Visualization tests for webgl1 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/14549/merge/testResults/webgl1/index.html

If tests were successful afterwards, this report might not be available anymore.

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 27, 2023

Visualization tests for webgl2 have failed. If some tests failed because the snapshots do not match, the report can be found at

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/14549/merge/testResults/webgl2/index.html

If tests were successful afterwards, this report might not be available anymore.

packages/dev/gui/src/2D/controls/container.ts Outdated Show resolved Hide resolved
packages/dev/gui/src/2D/controls/stackPanel.ts Outdated Show resolved Hide resolved
packages/dev/gui/src/2D/controls/stackPanel.ts Outdated Show resolved Hide resolved
@sebavan sebavan merged commit 0ed1bb5 into BabylonJS:master Dec 1, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants