Fork me on GitHub
#membrane
<
2022-11-11
>
phronmophobic23:11:37

I've been working on better support for alignment and stretch/row/column layouts. One design challenge I'm running into is:

(defui top [{}]
  (column
   {:rows [(halign {:child-pct 1 :parent-pct 0
                    :body (stretch-button {:text "Right to left (1 0)"})})
           (halign {:child-pct 0.5 :parent-pct 0
                    :body (stretch-button {:text "Center to left (0.5 0)"})})
           (halign {:child-pct 0.6 :parent-pct 0.2
                    :body (stretch-button {:text "Arbitrary (0.6 0.2)"})})]}))
The stretch-buttons are in the lexical scope of top, but their container size is based on the column component. It's fine that stretch-button doesn't have an intrinsic size (that's the point after all), but we still want to make sure we can turn it into an immutable view that does have a definite size. The problem is very tractable, but still needs a bit more hammock time to find a good balance between easy of use and simplicity of implementation.