13 ms·
For those that don't know, Auto Layout is just the cassowary linear constraint solving algorithm implemented in a nice UI library. There are a number of projec
by junon 5y ago
For those that don't know, Auto Layout is just the cassowary linear constraint solving algorithm implemented in a nice UI library.
There are a number of projects that already kind of do this (GSS being one of them, as someone else already mentioned) but with Houdini on the way this might become a very real contender in the near future.
I've already done some work with it - you can see a POC here: https://github.com/qix-/casscade https://github.com/qix-/casscade
One large problem (with GSS at least) was that it's difficult to "back-propagate" child layout values into parent containers. For example, if an element has a flexible width, then calculating what its width should be based on its textual content is very, very difficult with Cassowary - especially when that value should be used to influence its parent node's size.
- amelius 5y agoIs this the same kind of constraint solving algorithm as used in CAD packages like FreeCAD?
- junon 5y agoNot sure, though I doubt it. Linear constraint solvers are generally good for layouts et al, but not great for more involved engineering tasks. I've seen finite domain constraint solvers used in more general cases as they better support more nuanced operations at the cost of memory and processing power.
- amelius 5y agoYes, now that I think about it more deeply, I think that with engineering problems you are more likely to get quadratic constraints because of pythagoras' theorem.