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

Main axis constraints are lost by List #104

Open
LPGhatguy opened this issue Sep 20, 2023 · 0 comments
Open

Main axis constraints are lost by List #104

LPGhatguy opened this issue Sep 20, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@LPGhatguy
Copy link
Member

LPGhatguy commented Sep 20, 2023

constrained(Constraints::tight(Vec2::splat(100.0)), || {
    row(|| {
        text("Lorem ipsum dolor sit amet blah blah blah I just want some long text here");
    });
});

In this snippet, the text bleeds outside of the constrained area because List throws away the main axis constraints when laying out non-flex objects.

A workaround is to wrap the objects that need to be constrained in expanded or flexible with a non-zero flex factor:

constrained(Constraints::tight(Vec2::splat(100.0)), || {
    row(|| {
        expanded(|| {
            text("Lorem ipsum dolor sit amet blah blah blah I just want some long text here");
        });

        // OR

        flexible(1.0, || {
            text("Lorem ipsum dolor sit amet blah blah blah I just want some long text here");
        });
    });
});
@LPGhatguy LPGhatguy added the bug Something isn't working label Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant