Fork me on GitHub
#membrane
<
2022-11-17
>
Ben Sless08:11:03

Looks like an interesting use case for visualization :)

phronmophobic18:11:17

Interesting. What do you have in mind?

Ben Sless21:11:31

three columns of viscous with arrows drawn over?

phronmophobic22:11:08

I think if I were to try to visualize this, I would start with a generic diff tool. The source and result are pretty far away from each-other in their diagram. My guess is that it would be easier to read if the changes were shown in a more compact form.

Ben Sless04:11:25

Depends. The part of expressions depending on variables is completely independent

šŸ‘ 1
phronmophobic23:11:31

Getting close to stretch/alignment support that I'm happy about. Some aspects that I think are neat: ā€¢ the implementation is orthogonal to the rest of the API. ā€¢ as always, all components are pure functions and views are immutable ā€¢ there's no side-effecty/procedural "layout" step. ā€¢ alignment and stretch depends on ::container-size which is just a regular contextual property. It's not a new "type" of state. The ::container-size property can either be passed explicitly or threaded implicitly by defui as context. ā€¢ Even though you can't measure or draw a stretch/aligned element without a container size, it's still useful to be able to represent "a center aligned element". I'm pretty happy that it didn't require any changes to support this. You can omit the container size and assoc the container size later when it's available:

(def elem
  (center-align
   {:body (ui/rectangle 20 20)}))

(ui/bounds elem)
;; throws exception because bounds doesn't make sense
;; without a container size

(def sized-elem1
  (assoc-in elem
            [:context ::container-size] [40 100]))
(ui/bounds sized-elem1) ;; [30.0 60.0]


(def sized-elem2
  (assoc-in elem
            [:context ::container-size] [100 40]))
(ui/bounds sized-elem2) ;; [60.0 30.0]

šŸŽ‰ 1
šŸ“ 1