Allow the Space key to close Alert popups with no actual choice (#10085)

This commit is contained in:
SomeTroglodyte
2023-09-11 08:28:59 +02:00
committed by GitHub
parent c3484381c3
commit 19f9cba058

View File

@ -9,7 +9,6 @@ import com.unciv.logic.battle.Battle
import com.unciv.logic.city.City
import com.unciv.logic.civilization.AlertType
import com.unciv.logic.civilization.Civilization
import com.unciv.logic.civilization.LocationAction
import com.unciv.logic.civilization.NotificationCategory
import com.unciv.logic.civilization.PopupAlert
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
@ -64,6 +63,10 @@ class AlertPopup(
private fun getCity(cityId: String) = gameInfo.getCities().first { it.id == cityId }
//endregion
// This redirects all addCloseButton uses with only text and no action to accept the space key
private fun addCloseButton(text: String = Constants.close) =
addCloseButton(text, KeyboardBinding.NextTurnAlternate, null)
init {
// This makes the buttons fill up available width. See comments in #9559.
// To implement a middle ground, I would either simply replace growX() with minWidth(240f) or so,