bubbleboxer icon indicating copy to clipboard operation
bubbleboxer copied to clipboard

How to access Node to get size information?

Open Robert-M-Muench opened this issue 3 years ago • 4 comments

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 avatar May 28 '22 17:05 Robert-M-Muench

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

Robert-M-Muench avatar May 28 '22 17:05 Robert-M-Muench

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.

treilik avatar May 29 '22 07:05 treilik

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

Robert-M-Muench avatar May 29 '22 12:05 Robert-M-Muench

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.

treilik avatar May 31 '22 11:05 treilik