-
Notifications
You must be signed in to change notification settings - Fork 62
Flow layout #12
Comments
Hmm, that's an interesting question. I don't see how that would be currently possible though. AutoLayout is a system of relational mathematical constraints, so it would be necessary to express that behavior using these constraints (in the form of: view.right = view.left * multiplier + constant). In order to make something "flow", it would be necessary to create "conditional" constraints. We would need something like this:
Let's discuss and explore this idea here. |
Yes, if-then-else approach would work but it would be necessary to be able to test computed positions/dimensions. Or there could be a 'break point' operator like '/'. |
I really like that idea of a "break-operator" I've explored the idea a little bit and found that it requires an additional constraint. When view2 wraps to the next line, it's horizontal position cannot be determined unambiguously. One could assume that it's "left" position is aligned with the super-view, but this doesn't have to be the case. It's very well possible that there is a margin/spacer between the super-view and view1 and this needs to be accounted for. For this situation I think we could use a stack-view syntax, like this: Idea exploration from here on... So in order to build something like this, we would still need to extend the underlying constraint system to support conditionals. When translating this vfl
Hmm, it seems that using view2.right as an input condition isn't really possible, as I think we'd need to create a dummy view
And then the condition would become So hmm, but testing for And then we still need to figure out how to actually implement conditionals. Can it be done in autolayout alone or is it necessary to change the underlying cassowary/kiwi solver for this... Hope that makes any sense btw :) cheers |
+1! |
Is it somehow possible to define a flow layout, i.e. define that view2 should be right to view1 but could potentially wrap if needed and place itself on the next row/column ?
The text was updated successfully, but these errors were encountered: