diff --git a/core/src/com/unciv/ui/components/input/ActivationExtensions.kt b/core/src/com/unciv/ui/components/input/ActivationExtensions.kt index c623ad9657..51b93d7514 100644 --- a/core/src/com/unciv/ui/components/input/ActivationExtensions.kt +++ b/core/src/com/unciv/ui/components/input/ActivationExtensions.kt @@ -98,14 +98,13 @@ fun Actor.onRightClick(sound: UncivSound = UncivSound.Click, action: ActivationA * A [sound] will be played (concurrently) on activation unless you specify [UncivSound.Silent]. * @return `this` to allow chaining */ -@Suppress("unused") // Just in case - for now, only onRightClick is used +@Suppress("unused") // Just in case - for now, the Longpress in WorldMapHolder is using onActivation directly fun Actor.onLongPress(sound: UncivSound = UncivSound.Click, action: ActivationAction): Actor = onActivation(ActivationTypes.Longpress, sound, noEquivalence = true, action) /** Clears activation actions for a specific [type], and, if [noEquivalence] is `true`, * its [equivalent][ActivationTypes.isEquivalent] types. */ -@Suppress("unused") // Just in case - for now, it's automatic clear via clearListener fun Actor.clearActivationActions(type: ActivationTypes, noEquivalence: Boolean = true) { ActorAttachments.get(this).clearActivationActions(type, noEquivalence) } diff --git a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt index f7965ca077..988a8d18db 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt @@ -39,11 +39,11 @@ import com.unciv.ui.components.extensions.colorFromRGB import com.unciv.ui.components.extensions.darken import com.unciv.ui.components.extensions.surroundWithCircle import com.unciv.ui.components.extensions.toLabel +import com.unciv.ui.components.input.ActivationTypes import com.unciv.ui.components.input.KeyCharAndCode import com.unciv.ui.components.input.keyShortcuts import com.unciv.ui.components.input.onActivation import com.unciv.ui.components.input.onClick -import com.unciv.ui.components.input.onRightClick import com.unciv.ui.components.tilegroups.TileGroup import com.unciv.ui.components.tilegroups.TileGroupMap import com.unciv.ui.components.tilegroups.TileSetStrings @@ -124,14 +124,15 @@ class WorldMapHolder( } tileGroup.onClick { onTileClicked(tileGroup.tile) } - // On 'droid two-finger tap is mapped to right click and dissent has been expressed - if (Gdx.app.type == Application.ApplicationType.Android) - continue - - // Right mouse click listener - tileGroup.onRightClick { + // Right mouse click on desktop / Longpress on Android, and no equivalence mapping between those two, + // because on 'droid two-finger tap is mapped to right click and dissent has been expressed + tileGroup.onActivation( + type = if (Gdx.app.type == Application.ApplicationType.Android) + ActivationTypes.Longpress else ActivationTypes.RightClick, + noEquivalence = true + ) { val unit = worldScreen.bottomUnitTable.selectedUnit - ?: return@onRightClick + ?: return@onActivation Concurrency.run("WorldScreenClick") { onTileRightClicked(unit, tileGroup.tile) } @@ -695,7 +696,7 @@ class WorldMapHolder( if (nukeBlastRadius >= 0) selectedTile!!.getTilesInDistance(nukeBlastRadius) // Should not display invisible submarine units even if the tile is visible. - .filter { targetTile -> (targetTile.isVisible(unit.civ) && targetTile.getUnits().any { !it.isInvisible(unit.civ) }) + .filter { targetTile -> (targetTile.isVisible(unit.civ) && targetTile.getUnits().any { !it.isInvisible(unit.civ) }) || (targetTile.isCityCenter() && unit.civ.hasExplored(targetTile)) } .map { AttackableTile(unit.getTile(), it, 1f, null) } .toList() @@ -798,8 +799,7 @@ class WorldMapHolder( unitActionOverlays.clear() } - override fun reloadMaxZoom() - { + override fun reloadMaxZoom() { val maxWorldZoomOut = UncivGame.Current.settings.maxWorldZoomOut val mapRadius = tileMap.mapParameters.mapSize.radius