found box direction error

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-05 04:40:05 -06:00
parent 56cebf6db6
commit 825be13ee9
1 changed files with 11 additions and 11 deletions

View File

@ -8,8 +8,8 @@ import (
"go.wit.com/widget" "go.wit.com/widget"
) )
func (tk *guiWidget) placeBox(startW int, startH int) { func (w *guiWidget) placeBox(startW int, startH int) {
if tk.WidgetType != widget.Box { if w.WidgetType != widget.Box {
return return
} }
// tk.dumpTree("beforebox") // tk.dumpTree("beforebox")
@ -17,21 +17,21 @@ func (tk *guiWidget) placeBox(startW int, startH int) {
newW := startW newW := startW
newH := startH newH := startH
for _, child := range tk.children { for _, child := range w.children {
sizeW, sizeH := child.Size() sizeW, sizeH := child.Size()
log.Log(INFO, "BOX START size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH) log.Log(INFO, "BOX START size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH)
child.placeWidgets(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() sizeW, sizeH = child.Size()
if child.node.State.Direction == widget.Vertical { if w.node.State.Direction == widget.Vertical {
log.Log(INFO, "BOX IS VERTICAL ", tk.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String()) log.Log(INFO, "BOX IS VERTICAL ", w.String(), "newWH()", newW, newH, "child()", sizeW, sizeH, child.String())
// expand based on the child height // 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 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) log.Log(INFO, "BOX END size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH)
} }