Skip to content

Layout Algorithm

Andy Williams edited this page Apr 2, 2024 · 5 revisions

Note

This document is archived as it refers to a design process. This approach has now been agreed and work is being tracked on #4.


Part of a good toolkit is a flexible but easy to get started with layout algorithm. Though many are available it looks like Cassowary is a front runner for our needs.

Cassowary is a constraints based layout algorithm that is used in the iOS and Android toolkits and allows for incredible flexibility and control. From their website:

Cassowary is an incremental constraint solving toolkit that efficiently solves systems of linear equalities and inequalities. Constraints may be either requirements or preferences. Client code specifies the constraints to be maintained, and the solver updates the constrained variables to have values that satisfy the constraints.

There is no current working implementation to be found for Go so this may have to be implemented from scratch.