diff --git a/core/src/com/unciv/ui/tilegroups/CityButton.kt b/core/src/com/unciv/ui/tilegroups/CityButton.kt index 6afa7563a9..aae22ca240 100644 --- a/core/src/com/unciv/ui/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/tilegroups/CityButton.kt @@ -25,7 +25,6 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab val uncivGame = worldScreen.game init { - isTransform = true // If this is not set then the city button won't scale! touchable = Touchable.disabled } diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index 784371f0b5..f680ce69a9 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -77,7 +77,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) } val unitLayerGroup = UnitLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled } - val cityButtonLayerGroup = Group().apply { isTransform = true; setSize(groupSize, groupSize); + val cityButtonLayerGroup = Group().apply { setSize(groupSize, groupSize); touchable = Touchable.childrenOnly; setOrigin(Align.center) } val circleCrosshairFogLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) } diff --git a/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt index 27780304c9..a7e3eb9237 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt @@ -460,16 +460,20 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap worldScreen.shouldUpdate=true } - override fun zoom(zoomScale:Float){ + override fun zoom(zoomScale:Float) { super.zoom(zoomScale) - val scale = 1/scaleX // don't use zoomScale itself, in case it was out of bounds and not applied - if(scale < 1 && scale > 0.5f) - for(tileGroup in tileGroups.values) - tileGroup.cityButtonLayerGroup.setScale(scale) + val scale = 1 / scaleX // don't use zoomScale itself, in case it was out of bounds and not applied + if (scale >= 1) + for (tileGroup in tileGroups.values) + tileGroup.cityButtonLayerGroup.isTransform = false // to save on rendering time to improve framerate + if (scale < 1 && scale > 0.5f) + for (tileGroup in tileGroups.values) { + tileGroup.cityButtonLayerGroup.isTransform = true + tileGroup.cityButtonLayerGroup.setScale(scale) + } } // For debugging purposes - override fun draw(batch: Batch?, parentAlpha: Float) { - super.draw(batch, parentAlpha) - } + override fun draw(batch: Batch?, parentAlpha: Float) { super.draw(batch, parentAlpha) } + override fun act(delta: Float) { super.act(delta) } } \ No newline at end of file