From 825be13ee98bff8a981a905afa3a4f6402cf10ca Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 5 Feb 2024 04:40:05 -0600 Subject: [PATCH] found box direction error Signed-off-by: Jeff Carr --- place.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/place.go b/place.go index 4f24c48..03fa579 100644 --- a/place.go +++ b/place.go @@ -8,8 +8,8 @@ import ( "go.wit.com/widget" ) -func (tk *guiWidget) placeBox(startW int, startH int) { - if tk.WidgetType != widget.Box { +func (w *guiWidget) placeBox(startW int, startH int) { + if w.WidgetType != widget.Box { return } // tk.dumpTree("beforebox") @@ -17,21 +17,21 @@ func (tk *guiWidget) placeBox(startW int, startH int) { newW := startW newH := startH - for _, child := range tk.children { + for _, child := range w.children { sizeW, sizeH := child.Size() log.Log(INFO, "BOX START size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH) child.placeWidgets(newW, newH) + // re-get the Size (they should not have changed, but maybe they can?) + // TODO: figure this out or report that they did sizeW, sizeH = child.Size() - if child.node.State.Direction == widget.Vertical { - log.Log(INFO, "BOX IS VERTICAL ", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) + if w.node.State.Direction == widget.Vertical { + log.Log(INFO, "BOX IS VERTICAL ", w.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) // expand based on the child height - // something is wrong here - newW += sizeW - } else { - log.Log(INFO, "BOX IS HORIZONTAL", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) - // expand based on the child width - // something is wrong here newH += sizeH + } else { + log.Log(INFO, "BOX IS HORIZONTAL", w.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) + // expand based on the child width + newW += sizeW } log.Log(INFO, "BOX END size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH) }