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

Reactive sizing when using "true" #233

Open
Neobii opened this issue Apr 23, 2015 · 2 comments
Open

Reactive sizing when using "true" #233

Neobii opened this issue Apr 23, 2015 · 2 comments

Comments

@Neobii
Copy link

Neobii commented Apr 23, 2015

{{#Modifier size="[undefined, 500]" origin="[0, .5]" align="[0, .5]"}}
    {{#SequentialLayout}}
        {{#famousEach navLinks}}
            {{>Surface template="mainNav" size="[undefined, 100]"}}
        {{/famousEach}}
    {{/SequentialLayout}}
{{/Modifier}}

This will center it correctly if there are 5 elements, however if I put true instead of 500, it is not centered even though I height of the surface inside.

@gam-ragnar
Copy link

True means collapse to size of content. You need to set the width within which the items should be displayed

@gadicc
Copy link
Owner

gadicc commented May 7, 2015

Yeah, it's a bit confusing. My answer from #223 might help:

Ok so what's going on is that you haven't given the StateModifier any size. It's not like HTML where it will expand to fit it's contents. You can imagine it's children have a "position: absolute" and are taken out of the flow (well, not imagine... that really is what's happening). So it's size in this case is actually [0,0]. So it's aligning to middle, but it's origin is essentially the top left corner because it has size 0. The easy fix is just to give it a size.

In general, only Surface's are the only thing guaranteed to support true sizes. I'm not aware of any modifiers that do. Some views do, e.g. the famous-flex stuff (you can see it in action on the plugins, a Scrollview containing a true-sized FlexLayoutController, so the entire page scrolls with the full list, and not just the list leaving the rest of the page still).

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

3 participants