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

On Sizing Elements #136

Open
socantre opened this issue Sep 4, 2021 · 0 comments
Open

On Sizing Elements #136

socantre opened this issue Sep 4, 2021 · 0 comments

Comments

@socantre
Copy link
Contributor

socantre commented Sep 4, 2021

docs/ui/attributes.md contains:

!!!note "On Sizing Elements" Minimum and preferred sizes are defined in regular units, while the flexible sizes are defined in relative units. If any layout element has flexible size greater than zero, it means that all the available space will be filled out. The relative flexible size values of the siblings determines how big a proportion of the available space each sibling fills out. Most commonly, flexible width and height is set to just 0 or 1.

This does not appear to describe the actual behavior.

Based on the docs I would expect that if all elements have a flexible size of zero then the available space would not be filled. If some elements have a flexible size greater than zero and some have a flexible size of zero the docs make it sound like the elements with flexible size zero will not expand and the elements with a greater flexible size will expand, with the expansion of each such element proportional to their flexible size.

Not sure how the documentation should read to reflect the actual behavior. I assume the implementation can't be fixed to match the docs as that would break compatibility with existing mods.

See the test cases below:

<Defaults>
<VerticalLayout color="black" width="100" height="800"/>
<Text color="white" fontSize="16" minHeight="50" preferredHeight="50" flexibleHeight="0"/>
</Defaults>

<VerticalLayout offsetXY="-303 0">
    <Text>0</Text>
    <Text>0</Text>
    <Text>0</Text>
</VerticalLayout>
<VerticalLayout offsetXY="-202 0">
    <Text>0</Text>
    <Text>0</Text>
    <Text flexibleHeight="1">1</Text>
</VerticalLayout>
<VerticalLayout offsetXY="-101 0">
    <Text>0</Text>
    <Text>0</Text>
    <Text flexibleHeight="10">10</Text>
</VerticalLayout>
<VerticalLayout offsetXY="0 0">
    <Text>0</Text>
    <Text>0</Text>
    <Text flexibleHeight="100">100</Text>
</VerticalLayout>
<VerticalLayout offsetXY="101 0">
    <Text>0</Text>
    <Text>0</Text>
    <Text flexibleHeight="1000">1000</Text>
</VerticalLayout>
<VerticalLayout offsetXY="202 0">
    <Text>0</Text>
    <Text>0</Text>
    <Text flexibleHeight="10000">10000</Text>
</VerticalLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant