Jan Tlatlik
05/06/2021, 5:37 PMjim
05/06/2021, 6:19 PMJan Tlatlik
05/06/2021, 6:26 PMorangy
Layout
to place your nodes, and inside the content
parameter generate `Box`es with the GraphNode content, so that index of children is the same as index in your nodes list
• Inside Layout placement, just iterate over measurables
which will be in order of Boxes, and place them according to respective data in GraphNode. Calculate min/max positions and set layout size accordingly, so that you can use scrollable to navigate the graph when it’s bigger than view port.
• Use drawBehind
modifier to use same data to draw lines and other adornments on a Canvas. You can basically pass information back to this modifier by having a mutable structure that you initially fill with just offsets, and then in measuring phase add sizes. Since drawing always happens after layout, you’re guaranteed to have this data when drawing lines.orangy
Jan Tlatlik
05/07/2021, 8:26 AMorangy
layoutId
modifier, you can set on boxes, and it is available via Measurable.layoutId
extension property, so even better, you can just set it to GraphNode
on children boxes, and retrieve them in Layout. This avoids relying on indicies