sectionSizesForSpace returns section sizes. Input and outpus is measured in native pixels.
(orientation Orientation, space int, widths []int)
| 669 | |
| 670 | // sectionSizesForSpace returns section sizes. Input and outpus is measured in native pixels. |
| 671 | func (li *gridLayoutItem) sectionSizesForSpace(orientation Orientation, space int, widths []int) []int { |
| 672 | var stretchFactors []int |
| 673 | if orientation == Horizontal { |
| 674 | stretchFactors = li.columnStretchFactors |
| 675 | } else { |
| 676 | stretchFactors = li.rowStretchFactors |
| 677 | } |
| 678 | |
| 679 | var sectionCountWithGreedyNonSpacer int |
| 680 | var sectionCountWithGreedySpacer int |
| 681 | var stretchFactorsTotal [3]int |
| 682 | var minSizesRemaining int |
| 683 | minSizes := make([]int, len(stretchFactors)) |
| 684 | maxSizes := make([]int, len(stretchFactors)) |
| 685 | sizes := make([]int, len(stretchFactors)) |
| 686 | sortedSections := gridLayoutSectionInfoList(make([]gridLayoutSectionInfo, len(stretchFactors))) |
| 687 | |
| 688 | for i := 0; i < len(stretchFactors); i++ { |
| 689 | var otherAxisCount int |
| 690 | if orientation == Horizontal { |
| 691 | otherAxisCount = len(li.rowStretchFactors) |
| 692 | } else { |
| 693 | otherAxisCount = len(li.columnStretchFactors) |
| 694 | } |
| 695 | |
| 696 | for j := 0; j < otherAxisCount; j++ { |
| 697 | var item LayoutItem |
| 698 | if orientation == Horizontal { |
| 699 | item = li.cells[j][i].item |
| 700 | } else { |
| 701 | item = li.cells[i][j].item |
| 702 | } |
| 703 | |
| 704 | if item == nil { |
| 705 | continue |
| 706 | } |
| 707 | |
| 708 | if !shouldLayoutItem(item) { |
| 709 | continue |
| 710 | } |
| 711 | |
| 712 | info := li.item2Info[item] |
| 713 | flags := item.LayoutFlags() |
| 714 | |
| 715 | max := item.Geometry().MaxSize |
| 716 | |
| 717 | var pref Size |
| 718 | if hfw, ok := item.(HeightForWidther); !ok || !hfw.HasHeightForWidth() { |
| 719 | if is, ok := item.(IdealSizer); ok { |
| 720 | pref = is.IdealSize() |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | if orientation == Horizontal { |
| 725 | if info.spanHorz == 1 { |
| 726 | minSizes[i] = maxi(minSizes[i], li.MinSizeEffectiveForChild(item).Width) |
| 727 | } |
| 728 |
no test coverage detected