treilik / bubbleboxer

MIT License
64 stars 4 forks source link

How to access Node to get size information? #6

Open Robert-M-Muench opened 2 years ago

Robert-M-Muench commented 2 years ago

I need to access the size information of a node/leaf.

ModelMap returns tea.Model but how to get the matching node for my model? I think that's missing.

Robert-M-Muench commented 2 years ago

Looks, like that bubbleboxer sends a tea.WindowSizeMsg when the size changes. This msg can be accessed and handled in Update().

treilik commented 2 years ago

exactly, most likely you all so have to store the size in your (leaf-) model to retrieve the size when View is called to render the return string correctly.

You can walk through the LayoutTree and call on ever Node GetAddress and match to the string key of the ModelMap, does getting the matching node.

Robert-M-Muench commented 2 years ago

How about adding a NodeMap? IMO simpler to deal with than having to code LayoutTree traversal code outside of bubbleboxer.

treilik commented 2 years ago

Yeah, i dont have the time/mind for now, but if you like drop me a PR. May I ask you to elaborate your use-case a bit, so i get a better understanding how one might address this.