Fix flow layout
This commit is contained in:
parent
987f4bfc4a
commit
fc51ffe33c
@ -45,13 +45,14 @@ func (flow Flow) Arrange (hints tomo.LayoutHints, boxes tomo.BoxArranger) {
|
|||||||
index := 0
|
index := 0
|
||||||
for index < boxes.Len() {
|
for index < boxes.Len() {
|
||||||
// get a slice of boxes for this major step
|
// get a slice of boxes for this major step
|
||||||
|
stepIndexStart := index
|
||||||
stepIndexEnd := index + minorSteps
|
stepIndexEnd := index + minorSteps
|
||||||
if stepIndexEnd > boxes.Len() { stepIndexEnd = boxes.Len() }
|
if stepIndexEnd > boxes.Len() { stepIndexEnd = boxes.Len() }
|
||||||
index += minorSteps
|
index += minorSteps
|
||||||
|
|
||||||
// find a major size that will fit all boxes on this major step
|
// find a major size that will fit all boxes on this major step
|
||||||
majorSize := 0
|
majorSize := 0
|
||||||
for index := index; index < stepIndexEnd; index ++ {
|
for index := stepIndexStart; index < stepIndexEnd; index ++ {
|
||||||
boxSize := flow.major(boxes.MinimumSize(index))
|
boxSize := flow.major(boxes.MinimumSize(index))
|
||||||
if boxSize > majorSize { majorSize = boxSize }
|
if boxSize > majorSize { majorSize = boxSize }
|
||||||
}
|
}
|
||||||
@ -61,7 +62,7 @@ func (flow Flow) Arrange (hints tomo.LayoutHints, boxes tomo.BoxArranger) {
|
|||||||
var size image.Point
|
var size image.Point
|
||||||
size = flow.incrMajor(size, majorSize)
|
size = flow.incrMajor(size, majorSize)
|
||||||
size = flow.incrMinor(size, minorSize)
|
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) }
|
bounds := image.Rectangle { Min: point, Max: point.Add(size) }
|
||||||
boxes.SetBounds(index, bounds)
|
boxes.SetBounds(index, bounds)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user