From fc51ffe33cf051d38e9910b402cbbd96134fb722 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sat, 27 Jul 2024 14:41:46 -0400 Subject: [PATCH] Fix flow layout --- layouts/flow.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/flow.go b/layouts/flow.go index f083673..2420d0f 100644 --- a/layouts/flow.go +++ b/layouts/flow.go @@ -45,13 +45,14 @@ func (flow Flow) Arrange (hints tomo.LayoutHints, boxes tomo.BoxArranger) { index := 0 for index < boxes.Len() { // get a slice of boxes for this major step - stepIndexEnd := index + minorSteps + stepIndexStart := index + stepIndexEnd := index + minorSteps if stepIndexEnd > boxes.Len() { stepIndexEnd = boxes.Len() } index += minorSteps // find a major size that will fit all boxes on this major step majorSize := 0 - for index := index; index < stepIndexEnd; index ++ { + for index := stepIndexStart; index < stepIndexEnd; index ++ { boxSize := flow.major(boxes.MinimumSize(index)) if boxSize > majorSize { majorSize = boxSize } } @@ -61,7 +62,7 @@ func (flow Flow) Arrange (hints tomo.LayoutHints, boxes tomo.BoxArranger) { var size image.Point size = flow.incrMajor(size, majorSize) size = flow.incrMinor(size, minorSize) - for index := index; index < stepIndexEnd; index ++ { + for index := stepIndexStart; index < stepIndexEnd; index ++ { bounds := image.Rectangle { Min: point, Max: point.Add(size) } boxes.SetBounds(index, bounds)