From 6d185ea5a57495ab51eadfabcc0e294dcbc4dd2a Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Mon, 15 May 2023 08:09:39 +0200 Subject: [PATCH] Fix UnitTable layout (#9392) --- .../com/unciv/ui/screens/worldscreen/unit/UnitTable.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/UnitTable.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/UnitTable.kt index 1476698bd7..583e4a388a 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/UnitTable.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/UnitTable.kt @@ -106,10 +106,10 @@ class UnitTable(val worldScreen: WorldScreen) : Table() { add(unitIconNameGroup) add(nextIdleUnitButton) } - add(moveBetweenUnitsTable).colspan(2).fill().row() + add(moveBetweenUnitsTable).fill().row() - separator = addSeparator().actor!! - add(promotionsTable).colspan(2).row() + separator = addSeparator().padBottom(5f).actor!! + add(promotionsTable).row() add(unitDescriptionTable) touchable = Touchable.enabled onClick { @@ -262,13 +262,14 @@ class UnitTable(val worldScreen: WorldScreen) : Table() { unitIconHolder.clear() promotionsTable.clear() unitDescriptionTable.clearListeners() + separator.width = 0f // ImageWithCustomSize remembers width and returns if when Table asks for prefWidth if (selectedUnit != null) { if (selectedUnits.size == 1) { // single selected unit unitIconHolder.add(UnitGroup(selectedUnit!!, 30f)).pad(5f) for (promotion in selectedUnit!!.promotions.getPromotions(true)) - promotionsTable.add(ImageGetter.getPromotionPortrait(promotion.name)) + promotionsTable.add(ImageGetter.getPromotionPortrait(promotion.name)).padBottom(2f) // Since Clear also clears the listeners, we need to re-add them every time promotionsTable.onClick {