Resolved #2611 - City button shrinks on zoom in, showing the 'hidden' unit icons behind it

This commit is contained in:
Yair Morgenstern 2020-05-15 00:36:06 +03:00
parent de337a0ca2
commit 54dd7e5d62
3 changed files with 11 additions and 2 deletions

View file

@ -67,7 +67,8 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
val unitLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
val cityButtonLayerGroup = Group().apply { isTransform = true; setSize(groupSize, groupSize);touchable = Touchable.childrenOnly }
val cityButtonLayerGroup = Group().apply { isTransform = true; setSize(groupSize, groupSize);
touchable = Touchable.childrenOnly; setOrigin(Align.center) }
val circleCrosshairFogLayerGroup = Group().apply { isTransform = false; setSize(groupSize, groupSize) }
private val circleImage = ImageGetter.getCircle() // for blue and red circles on the tile

View file

@ -16,7 +16,7 @@ open class ZoomableScrollPane: ScrollPane(null) {
addZoomListeners()
}
fun zoom(zoomScale: Float) {
open fun zoom(zoomScale: Float) {
if (zoomScale < 0.5f || zoomScale > 10) return
setScale(zoomScale)
}

View file

@ -347,4 +347,12 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
worldScreen.shouldUpdate=true
}
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)
}
}