mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 13:27:22 -04:00
City overview Fix Hotfix (#10220)
* Hotfix kludge to make City Overview behave when not taking up all screen width * Guard against unsupported SortableGrid config
This commit is contained in:
parent
937f21188c
commit
ccddf1e018
@ -87,6 +87,10 @@ class SortableGrid<IT, ACT, CT: ISortableGridContentProvider<IT, ACT>> (
|
||||
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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider<City, EmpireOver
|
||||
|
||||
Construction {
|
||||
override val align = Align.left
|
||||
override val expandX = true
|
||||
override val expandX = false
|
||||
override val equalizeHeight = true
|
||||
override val headerTip = "Current construction"
|
||||
override val defaultDescending = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user