diff --git a/core/src/com/unciv/ui/components/SortableGrid.kt b/core/src/com/unciv/ui/components/SortableGrid.kt index ed26ffcdcb..b9a2932c57 100644 --- a/core/src/com/unciv/ui/components/SortableGrid.kt +++ b/core/src/com/unciv/ui/components/SortableGrid.kt @@ -87,6 +87,10 @@ class SortableGrid> ( private val totalsRow = Table(skin) init { + require (!separateHeader || columns.none { it.expandX }) { + "SortableGrid currently does not support separateHeader combined with expanding columns" + } + headerRow.defaults().pad(paddingVert, paddingHorz).minWidth(iconSize) details.defaults().pad(paddingVert, paddingHorz).minWidth(iconSize) totalsRow.defaults().pad(paddingVert, paddingHorz).minWidth(iconSize) diff --git a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTab.kt b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTab.kt index 95a9484524..ca6652a6bb 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTab.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTab.kt @@ -36,13 +36,21 @@ class CityOverviewTab( separateHeader = true ) { header, details, totals -> + // Notes: header.parent is the LinkedScrollPane of TabbedPager. Its linked twin is details.parent.parent.parent however! + // horizontal "slack" if available width > content width is taken up between SortableGrid and CityOverviewTab for the details, + // but not so for the header. We must force the LinkedScrollPane somehow (no? how?) to do so - or the header Table itself. + equalizeColumns(details, header, totals) + // todo Kludge! Positioning and alignment of the header Table within its parent has quirks when content width < stage width + // This code should likely be included in SortableGrid anyway? + if (header.width < this.width) header.width = this.width this.validate() } override fun getFixedContent() = grid.getHeader() init { + top() add(grid) } } diff --git a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt index d23b443472..54c863e60b 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/CityOverviewTabColumn.kt @@ -85,7 +85,7 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider