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
Conversation
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/14549/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/14549/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/14549/merge#BCU1XR#0 |
Visualization tests for webgl1 have failed. If some tests failed because the snapshots do not match, the report can be found at If tests were successful afterwards, this report might not be available anymore. |
Visualization tests for webgl2 have failed. If some tests failed because the snapshots do not match, the report can be found at If tests were successful afterwards, this report might not be available anymore. |
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.