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

Float vertical alignment #6

Open
kj opened this issue May 20, 2015 · 0 comments
Open

Float vertical alignment #6

kj opened this issue May 20, 2015 · 0 comments

Comments

@kj
Copy link

kj commented May 20, 2015

This is more documentation of the hack I used to deal with this problem. When floats forced down onto a new row meet a taller element (other than the last of the previous row), they're pushed to the right. This causes Orderly to miscalculate the length of each row (as pushed rows will have less elements than they should).

This can be especially confusing when used with method: 'children', as the rows generally end up correctly aligned, but certain children may have been resized based on the previously incorrect row lengths.

I couldn't think of an efficient way to deal with this, so I've changed method: 'children' to not only register Orderly on the parent after the children, but also before the children. This causes Orderly to resize the parent rows twice. First, to settle any issues with floats (by giving them equal heights per row), then again to match the final sum heights of the child elements.

Feels dirty, but it works for now.

I wonder if it is actually necessary to register Orderly on the parent at all? Perhaps it could follow something more like:

  1. Resize parent
  2. Resize children
  3. Reset parent

That way, at least the last execution on parent is more efficient. If it's absolutely necessary, the user could always manually register Orderly on the parent. We'd just redefine method: 'children' to mean registering Orderly on all the children of element, but not the element itself.

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